Ich habe ein Problem mit der Rückkehr Observable von der zweiten Anfrage. Etwas wie folgt aus:rxjs Rückgabewert von der zweiten Anfrage
commandRequest(action:string, commandData:any):Observable<CashDesckResponse>
{
let command:CashDeskRequest;
//ask my backend for command
this.requestCommandString(action, commandData, "POST")
//this is my response from backend
.map(r=>r.response).subscribe(my_1_response=>{
//then i need to send this response data to other server/action
//to execute it and return this second response as the result of
//this method.
command = new CashDesckRequest(my_1_response);
return this.server.executeCommand(command).map(return_this=>return_this);
});
};
private requestCommandString(action:string, requestData:any,
type:string):Observable<AjaxResponse>{
return Observable.ajax({
body:JSON.stringify(requestData),
method:type,
url:this._apiServerUrl+action
}).map(r=>r);
};
Mein Problem, dass die commandRequest Rückgabewert von ersten .map(). Und wenn ich versuche, den Wert von inner subscribe compiller werfen Fehler: [ts] Eine Funktion, deren deklarierter Typ weder 'void' noch 'any' muss einen Wert zurückgeben. https://habrastorage.org/web/93b/e6b/17b/93be6b17bf5b46b5847e67deefd6eea1.png