我想使用来自多个 api 请求的返回结果并将其作为第二个 api 请求的参数重用,第二个 api 请求返回我必须在第三个 api 请求中重用的结果!
问题是我只能返回一个 api
const email = this.credentialsForm.controls['email'].value;
this.http.get('https://drupal_users/index/' + email).pipe(
map(users => {
console.log(users);
const user = users;
this.userId = user;
return user;
}),
mergeMap(user => {
const ObservateurCulture = this.http.get('https://index.php/drupal_users/culture/' + email).subscribe((culture: any) => {})
// Here i wish to reuse "culture" data in another Api call and reuse result again of "Parcelles" api request
const Parcelles = this.http.get('https://index.php/drupal_users/totherdata/' + culture);
return forkJoin([ObservateurCulture, Parcelles]);
}),
take(1)
).subscribe(result => {
console.log(result);
this.loading.dismiss();
});