Skip to content

Commit 35f9b37

Browse files
authored
Merge pull request #1079 from RADAR-base/feature/fix-errorhandler
Update frontend error handler interceptor
2 parents b78e163 + 0241675 commit 35f9b37

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/main/webapp/app/blocks/interceptor/errorhandler.interceptor.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,10 @@ export class ErrorHandlerInterceptor implements HttpInterceptor {
2222
tap(
2323
() => {},
2424
(err: HttpErrorResponse) => {
25-
if (err.status === 401) {
26-
this.injector.get(AuthService).resetAuthentication(
27-
// no redirect needed when just checking whether authentication is present.
28-
request.url !== 'api/account'
29-
);
25+
if (err.status === 401 && request.url === 'api/account') {
26+
// If the account endpoint says 401, the user is no longer authenticated:
27+
// clear authentication and redirect to login/access denied.
28+
this.injector.get(AuthService).resetAuthentication(true);
3029
return;
3130
}
3231
if (err.status === 409 && request.method === 'DELETE') {

0 commit comments

Comments
 (0)