I would like query an Api that returns dada and next item that contains the next url to call.
When next is null it means that all data is sent.
getData(url?: any) {
if (!url) {
url = `https....../geojson/geo/?srid=xxx&code=xx&jsonb_as_text=false&page_size=10`;
}
return this.httpClient.get(url, { headers }).pipe(
flatMap((res: any) => {
if (res.next) {
this.getData(res.next);
}
return res;
})
);
}
Actually the component only gets the first call but not the second.
How can I chain well api calls and concat the results then?