我有一个父HTTP请求,需要首先完成它(getTrialForPatient),响应时,我需要再执行两个需要并发的http请求(getDailyQuestionaireData,getStartEndQuestionaireData) 我尝试使用forkJoin,但无法成功。知道我做错了什么吗?
private _trialListPoll$ = timer(0, this.listRequestInterval).pipe(switchMap(()=>{
return this.trialDataService.getTrailForPatient(this.patientId).pipe(map(data=>{
if(data && data.result && data.result.length > 0){
const trial = data.result[0] as TrialPhase;
this.trialId = trial.trialId;
return data.result[0];
}));
}
),switchMap(()=>forkJoin( this.trialDataService.getDailyQuestionaireData(this.trialId),this.trialDataService.getStartEndQuestionaireData(this.trialId)),tap(([res1, res2])=> {
console.log(res1,res2,"works ? ")
}))
,share());