update more checking error

This commit is contained in:
Kenta420-Poom 2023-09-21 09:01:59 +07:00
parent 8221183630
commit edabaf7396
3 changed files with 17 additions and 6 deletions

View file

@ -8,7 +8,7 @@ import {
} from '@angular/common/http';
import { Observable, catchError, retry, throwError } from 'rxjs';
@Injectable()
@Injectable({ providedIn: 'root' })
export class ErrorInterceptor implements HttpInterceptor {
constructor() {}
@ -19,11 +19,7 @@ export class ErrorInterceptor implements HttpInterceptor {
return next.handle(request).pipe(
catchError((error) => {
if (error instanceof HttpErrorResponse) {
if (error.status === 401) {
return next.handle(request);
}
}
return throwError(() => error);
})
);