1
Ich habe diese dunction umgesetzt:RxJS: Kartenfunktion nicht erreicht
public deleteCards(user: string, tokens: Array<string>, extraHttpRequestParams?: any): Observable<{}> {
return this.deleteCardsWithHttpInfo(user, tokens, extraHttpRequestParams)
.map((response: Response) => {
if (response.status === 204) {
return undefined;
} else {
return response.json();
}
}).catch((error: any) => {
if (error.status >= 500) {
return Observable.throw(new Error(error.status));
}
else { //if (error.status >= 400) {
const body = error.json() || '';
const code = body.error || JSON.stringify(body);
const message = body.message || JSON.stringify(body);
return Observable.throw(ApiError.create(code, message));
}
});
}
Wie Sie sehen können, ist es eine Observable<{}>
zurückgibt. Ich rufe, dass als:
this.deleteCards(action.payload.username, action.payload.tokens)
.map(() => { ((((1))))
return <Action>{
type: 'DELETE_CARDS_SUCCESS',
payload: action.payload.tokens
};
})
.catch(_ => {
return Observable.of(<Action>{ type: 'DELETE_CARDS_FAILED', payload: { }});
}));
Dennoch ((((1))))
nie erreicht wird.
habe ich auch mit diesem versucht:
.map(_ => { ...
.map((p:any) => {...
aber es wird nie erreicht.
Nun ... wie können wir wissen? Wahrscheinlich gibt this.leleteCardsWithHttpInfo() wahrscheinlich nie etwas aus. – martin