diff --git a/pmp-ui/src/app/app.constants.ts b/pmp-ui/src/app/app.constants.ts index 9f95bd979..bfbaefcb7 100644 --- a/pmp-ui/src/app/app.constants.ts +++ b/pmp-ui/src/app/app.constants.ts @@ -1,5 +1,5 @@ import * as config from 'src/assets/config.json'; - +export const AUTH_ERROR_CODE = ['KER-ATH-007','KER-ATH-006']; export const VERSION = '1.0'; export const BASE_URL = config.baseUrl; export const IDS = 'dummy'; diff --git a/pmp-ui/src/app/core/services/httpinterceptor.ts b/pmp-ui/src/app/core/services/httpinterceptor.ts index 2ddc529f3..aab056f2e 100644 --- a/pmp-ui/src/app/core/services/httpinterceptor.ts +++ b/pmp-ui/src/app/core/services/httpinterceptor.ts @@ -17,6 +17,7 @@ import { DialogComponent } from 'src/app/shared/dialog/dialog.component'; import { TranslateService } from '@ngx-translate/core'; import { AppConfigService } from 'src/app/app-config.service'; import jwt_decode from "jwt-decode"; +import * as appConstants from 'src/app/app.constants'; @Injectable({ providedIn: 'root' @@ -59,6 +60,13 @@ export class AuthInterceptor implements HttpInterceptor { this.headerService.setRoles(event.body.response.role); this.headerService.setNotificationLanguage(this.decoded["langCode"]); } + if ( + event.body.errors !== null && + (event.body.errors[0]['errorCode'] === + appConstants.AUTH_ERROR_CODE[0] || event.body.errors[0]['errorCode'] === appConstants.AUTH_ERROR_CODE[1]) + ) { + this.redirectService.redirect(window.location.href); + } } } },