I am using Angular HttpClient in a Ionic 3 App. I also used RxJs operators as a wrapper for my http request.
Here is my code below:
getDriverMeInfo() {
return this.http.get(`${this.global.baseUrl}/me`)
.retryWhen(e => e.do(err => { if (err instanceof HttpErrorResponse) console.log(err) })
.delay(10000).take(10) // Delay after 10 seconds when an error occured and retry maximum of 10 takes
).toPromise()
}
I call this function every time that app has successfully booted or loaded. The function retries when an error occured. What I want to happen is how would I know if the http request has reached 10 retries in the take method?
Appreciate if someone could help. Thanks in advance.