I have the code below:
data$ = getResponse1$.pipe(
tap((res1: any) => {
this.qService.data = res1;
}),
switchMap(() =>
of(getResponse2$(res2)).pipe(
map((val) => {
const res: any = {
val,
};
return res;
})
)
)
);
Is it possible to run getResponse1$ i.e. the first observable, along with getResponse2$ only when a condition is true? Otherwise, I want to execute only getResponse2$.