typescript - RxJS: map function not reached -
i've implemented dunction:
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)); } }); }
as can see, returns observable<{}>
. i'm calling as:
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: { }}); }));
nevertheless, ((((1))))
never reached.
i've tried this:
.map(_ => { ...
.map((p:any) => {...
but it's never reached.
you have subscribe observable anything:
this.deletecards(...).map(...).catch(...).subscribe((action: action) => { // action. });
Comments
Post a Comment