I have an angular 6 app that is configured to retry http requests 3 times on failure. I would like to exclude certain urls from that policy: /login (for example).
Is there a way to do that?
I could not find any answers in the RxJs documentation.
Thank you for any help
Here's my code:
@Injectable()
export class RetryInterceptor implements HttpInterceptor {
constructor( public spinnerService: NgxSpinnerService ) { }
timer: any;
intercept(req: HttpRequest<any>, next: HttpHandler):
Observable<HttpEvent<any>> {
if(this.timer){
clearTimeout(this.timer);
}
this.timer = setTimeout(() => this.spinnerService.show(), 500);
let handleObs: Observable<HttpEvent<any>> = next.handle(req)
.pipe(
retry(3),
finalize(() =>{
this.spinnerService.hide();
if(this.timer){
clearTimeout(this.timer);
}
}
)
);
return handleObs;
};
}