|
|
@ -103,7 +103,8 @@ export class GlobalHttpInterceptor implements HttpInterceptor { |
|
|
const ignoreErrors = config.ignoreErrors; |
|
|
const ignoreErrors = config.ignoreErrors; |
|
|
const resendRequest = config.resendRequest; |
|
|
const resendRequest = config.resendRequest; |
|
|
const errorCode = errorResponse.error ? errorResponse.error.errorCode : null; |
|
|
const errorCode = errorResponse.error ? errorResponse.error.errorCode : null; |
|
|
if (errorResponse.error && errorResponse.error.refreshTokenPending || errorResponse.status === 401) { |
|
|
if (errorResponse.error && errorResponse.error.refreshTokenPending || |
|
|
|
|
|
errorResponse.status === 401 && req.url !== Constants.entryPoints.tokenRefresh) { |
|
|
if (errorResponse.error && errorResponse.error.refreshTokenPending || |
|
|
if (errorResponse.error && errorResponse.error.refreshTokenPending || |
|
|
errorCode && errorCode === Constants.serverErrorCode.jwtTokenExpired) { |
|
|
errorCode && errorCode === Constants.serverErrorCode.jwtTokenExpired) { |
|
|
return this.refreshTokenAndRetry(req, next); |
|
|
return this.refreshTokenAndRetry(req, next); |
|
|
@ -153,7 +154,7 @@ export class GlobalHttpInterceptor implements HttpInterceptor { |
|
|
return this.jwtIntercept(req, next); |
|
|
return this.jwtIntercept(req, next); |
|
|
}), |
|
|
}), |
|
|
catchError((err: Error) => { |
|
|
catchError((err: Error) => { |
|
|
this.authService.logout(true); |
|
|
this.authService.logout(true, true); |
|
|
const message = err ? err.message : 'Unauthorized!'; |
|
|
const message = err ? err.message : 'Unauthorized!'; |
|
|
return this.handleResponseError(req, next, new HttpErrorResponse({error: {message, timeout: 200}, status: 401})); |
|
|
return this.handleResponseError(req, next, new HttpErrorResponse({error: {message, timeout: 200}, status: 401})); |
|
|
})); |
|
|
})); |
|
|
|