There is an API where the HTTP request has been sent and there is no response for a long time but when the user refreshes the page the API responds immeditally this behavior occurs often, so I want to use RXJS to overcome this issue. when the API does not respond within 40 seconds it should automatically retry the HTTP request & it should be attempted 3 times. how to achieve this behavior using RXJS
Here is the code:
ABC.service.ts
getABC() {
return this.http
.get(.........)
.pipe(
map(responseData => {
return responseData
}),
catchError(errorRes => {
return this.handleError(errorRes);
})
);
}
XYZ.component.ts
this._abcService.getABC().subscribe((res: any[]) => {
console.log(res);
}, error => {
console.log(error);
});
Help me with this Issue