I have the following code to get id and then data related to the id.
process(): Observable<any> {
let id: number;
return this.getId().flatMap(
(response: number) => {
id = response;
return this.getData(id)
}
).flatMap(
(data: any) => {
return Observable.of(data);
}
);
}
getData(id: number): Observable<any> {
// retry if response.status is not complete
return this.service.getData(id).map(response => return response.data);
}
I would like to add retry logic on getData method until response.status is not complete. I tried adding retry/retryWhen after this.getData(id) but no luck. Any suggestions please?