diff --git a/error-interceptor.service.ts b/error-interceptor.service.ts index 2dbe2f68..f0891657 100644 --- a/error-interceptor.service.ts +++ b/error-interceptor.service.ts @@ -7,7 +7,6 @@ import {Router} from "@angular/router"; import {LoginErrorCodes} from "./login/utils/guardHelper.class"; import {properties} from "../../environments/environment"; import {isArray} from "util"; -import {element} from "@angular/core/src/render3"; @Injectable() export class ErrorInterceptorService implements HttpInterceptor { @@ -20,8 +19,10 @@ export class ErrorInterceptorService implements HttpInterceptor { intercept(req: HttpRequest, next: HttpHandler): Observable> { return next.handle(req).pipe(catchError(err => { if ((err.status === 0 && this.isService(req, properties.registryUrl)) || - (err.status === 401 && !this.isService(req, ErrorInterceptorService.UNAUTHORIZED_WHITELIST)) || err.status === 403) { + (err.status === 401 && !this.isService(req, ErrorInterceptorService.UNAUTHORIZED_WHITELIST))) { this.logOut(); + } else if(err.status === 403) { + this.unauthorized(); } return throwError(err); })); @@ -44,4 +45,13 @@ export class ErrorInterceptorService implements HttpInterceptor { } }); } + + unauthorized() { + this.router.navigate(['/user-info'], { + queryParams: { + 'errorCode': LoginErrorCodes.NOT_AUTHORIZED, + 'redirectUrl': this.router.url + } + }); + } } diff --git a/sharedComponents/navigationBar.component.html b/sharedComponents/navigationBar.component.html index 05b69fdf..91b0aa14 100644 --- a/sharedComponents/navigationBar.component.html +++ b/sharedComponents/navigationBar.component.html @@ -7,7 +7,7 @@
-