Auth errors were not showing up as they were swallowed up by the auth interceptor.
Once caught, the device name was not being shown as it was triggering an expression changed after detection error.
This commit is contained in:
@ -21,13 +21,13 @@ export const authInterceptor: HttpInterceptorFn = (req, next) => {
|
||||
if (req.url.includes('/refresh')) {
|
||||
inject(AuthService).logout();
|
||||
}
|
||||
return throwError(() => new Error(err));
|
||||
return throwError(() => err);
|
||||
}
|
||||
// If error status is different than 401 we want to skip refresh token
|
||||
// So we check that and throw the error if it's the case
|
||||
if (err.status !== 401) {
|
||||
const error = err.error.message || err.error.detail || err.statusText;
|
||||
return throwError(() => new Error(error));
|
||||
return throwError(() => error);
|
||||
}
|
||||
// auto logout if 401 response returned from api
|
||||
inject(AuthService).logout();
|
||||
@ -47,7 +47,7 @@ export const authInterceptor: HttpInterceptorFn = (req, next) => {
|
||||
inject(Router).navigate(['login']);
|
||||
}
|
||||
});
|
||||
return throwError(() => new Error(err));
|
||||
return throwError(() => err);
|
||||
}),
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user