I have a parent observable and two child observables who are getting the trialId
from parent response and do http calls on their own. I tried to use mergeMap
but it gives me error that it's not a function. How could I do this ?
private _trialListPoll$ = timer(0, this.listRequestInterval).pipe(
this.trialDataService.getTrailForPatient(this.patientId).mergeMap(
(data) => {
if (data.result.length > 0) {
const trial = data.result[0] as TrialPhase;
this.trialId = trial.trialId;
this.trialStartDate = trial.startDate;
this.trialEndDate = trial.endDate;
this.trialData$.next(data.result[0]);
this.loadDailyQuestionaireAnswerData(this.trialId); // child which makes http call and being subscribed somewhere
this.loadStartEndQuestionaireData(this.trialId); // child which makes http call and being subscribed somewhere
} else {
this.trialStartDate = undefined;
this.trialEndDate = undefined;
this.trialData$.next(undefined);
}
this.isQuestionnaireInDateRange();
this.isLoadingTrial$.next(false);
}
),share());