export class AppHttpInterceptor implements HttpInterceptor {
private cache = new HttpCache();
private cacheURLList = [];
count = 0;
constructor(@Inject(AppBlockUiService) private appBlockUiService: AppBlockUiService,
@Inject(AppMessageService) private appMessageService: AppMessageService) {
}
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
const started = Date.now();
this.blockUi();
return next.handle(serverReq)
.timeout(720000)
.do(
event => {
if (event instanceof HttpResponse) {
this.unBlockUi();
}
}, err => {
if (err instanceof HttpErrorResponse) {
// this.appBlockUiService.unblockUi();
}
this.unBlockUi();
}
);
}
}
So I have an http interceptor that i am using to have a loading mask on ui while making http calls, but i am facing issue that while http request is cancelled because of using unsubscribe or because of timeout. the unblock method is not called.
Is there a way to handle cancelled request via unsubscibed and via timeout?