I have a component that invokes a few http requests to different url's. Each request is implemented as an observable.
getIds():Observable<any[]> {
return this.http
.post(url1, '')
.pipe(map(({ Ids}: any) => Ids.map(item => ({Id: item.Id }))));
}
getNames(data: Names):Observable<any[]> {
return this.http
.post(url2,element)
.pipe(map(({ Results }: any) => Results[0].map(item => ({id: item.ID, name: item.CVSS}))));
}
From the component, I need to do,
ngOnInit() {
this.Ids = this.getIds();
Ids.forEach(function(element)
this.getNames();
}
Can someone please show how I can enforce this order?