How do I handle cancelled requests in http interceptor? I have tried various methods from SO, but none of them seem to catch it.
This is how my interceptor is,
public intercept(req: HttpRequest<any>, next: HttpHandler) {
const xyz = this._cookieService.get('xyz');
const abc = this._cookieService.get('abc');
let authReq;
if (jwt === "undefined" || jwt === undefined) {
authReq = req.clone({ headers: req.headers.set('Authorization', xyz) });
} else {
authReq = req.clone({setHeaders: { Authorization: 'bearer ' + abc } });
}
return next
.handle(authReq)
.pipe(
catchError((err: HttpErrorResponse) => this.catchErrorHandler(err))
);
}
I have tried the do, finalize methods as well. Its that, my auth expires, and all the requests after that just collapse one by one, and the page breaks. I would like to handle it with code, so that the page doesn't break.
Methods I have tried:
https://stackoverflow.com/a/50620910/6630504
https://stackoverflow.com/a/55756885/6630504
