Update about the showing the user images

This commit is contained in:
Sébastien André
2021-03-26 15:05:06 +01:00
parent 9d51f38f2e
commit fe255041cc
12 changed files with 70 additions and 71 deletions

View File

@@ -5,20 +5,25 @@ import { catchError } from 'rxjs/operators';
import { AuthenticationService } from '../services/authentication.service';
@Injectable()
export class ErrorInterceptor implements HttpInterceptor {
constructor(private authenticationService: AuthenticationService) { }
intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
return next.handle(request).pipe(catchError(err => {
if (err.status === 401) {
// auto logout if 401 response returned from api
this.authenticationService.logout();
location.reload(true);
}
return next.handle(request)
.pipe(
catchError(err => {
if (err.status === 401) {
// auto logout if 401 response returned from api
this.authenticationService.logout();
location.reload();
}
const error = err.error.message || err.statusText;
return throwError(error);
}));
const error = err.error.message || err.statusText;
return throwError(error);
})
);
}
}