I have the following observable:
existingFormData$: Observable<any> = this.activatedRoute.params.pipe(
map(params => params['id']),
filter(id => !!id),
switchMap((id: string) => this.httpService.getUniversityApplicationsDetail(id)),
concatMap((detail: any) => this.httpService.getUniversityApplicationsFeesOptions(detail.meta.university.id)),
tap((detail: any) => {
console.log(detail)
})
);
I'm looking up the id contained in the address bar, calling up the 1st api, getting an id value from the 1st api and sending that off to the 2nd api. Both apis return an object. Is concatMap the correct operator for this? It seems to work looking in my Network tab.
The problem I have is that both apis have exactly the same structure. How can I construct 1 object which looks like this:
{
apiOne: apiOne,
apiTwo: apiTwo
}