I am currently facing an issue with conditional calls in RxJS. The situation involves multiple HTTP calls within a forkJoin. However, there are dependencies present - for example, the second call should only be made if a boolean value from the first call is true. Here is my current code snippet:
service.method(parameters).pipe(
tap((data: boolean) => {
foo.bar = data;
}),
concatMap(() =>
service
.method(parameters)
.pipe(
tap((data: KeyValue<number, string>[]) => {
if (true) {
foo.foo = data;
}
})
)
)
)
The issue I am facing is that the method is being called regardless of the condition. My objective is for the method to only be called when the parameter is true, in order to minimize the number of calls. Any assistance in resolving this would be greatly appreciated.