I need to combine two api calls - serviceA and serviceB. serviceB should be called right after serviceA. However, if serviceA fails, the code should continue execution and call serviceB.
What's the right way to do it, using RxJS?
Here's what I've tried:
this.serviceA.getData(id).pipe(
map((data) => {
return { ...data, test: "abc" };
}),
mergeMap((res) => {
return this.serviceB.getData(id).pipe(
map((scores) => this.handleData(scores)),
catchError(() => of(res))
);
})
);