RED-6802, fixed the notification not showing up.
This commit is contained in:
parent
7821b5a2f6
commit
01d06f1c87
@ -1,4 +1,12 @@
|
||||
import { HttpErrorResponse, HttpEvent, HttpHandler, HttpInterceptor, HttpRequest, HttpStatusCode } from '@angular/common/http';
|
||||
import {
|
||||
HttpErrorResponse,
|
||||
HttpEvent,
|
||||
HttpHandler,
|
||||
HttpInterceptor,
|
||||
HttpRequest,
|
||||
HttpResponse,
|
||||
HttpStatusCode,
|
||||
} from '@angular/common/http';
|
||||
import { Inject, Injectable, Optional } from '@angular/core';
|
||||
import { MonoTypeOperatorFunction, Observable, retry, throwError, timer } from 'rxjs';
|
||||
import { catchError, tap } from 'rxjs/operators';
|
||||
@ -57,7 +65,14 @@ export class ServerErrorInterceptor implements HttpInterceptor {
|
||||
|
||||
intercept(req: HttpRequest<unknown>, next: HttpHandler): Observable<HttpEvent<unknown>> {
|
||||
return next.handle(req).pipe(
|
||||
catchError((error: HttpErrorResponse) => {
|
||||
tap(event => {
|
||||
if (event instanceof HttpResponse && this._urlsWithError.has(req.url)) {
|
||||
this._errorService.setOnline();
|
||||
this._urlsWithError.delete(req.url);
|
||||
}
|
||||
}),
|
||||
catchError((err: unknown) => {
|
||||
const error = err as HttpErrorResponse;
|
||||
// token expired
|
||||
if (error.status === HttpStatusCode.Unauthorized) {
|
||||
this._keycloakStatusService.createLoginUrlAndExecute();
|
||||
@ -72,12 +87,6 @@ export class ServerErrorInterceptor implements HttpInterceptor {
|
||||
return throwError(() => error);
|
||||
}),
|
||||
backoffOnServerError(this._maxRetries, this._skippedPaths),
|
||||
tap(() => {
|
||||
if (this._urlsWithError.has(req.url)) {
|
||||
this._errorService.setOnline();
|
||||
this._urlsWithError.delete(req.url);
|
||||
}
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user