update: google oauth2.0 with hd=email@forth.co.th only now functional

This commit is contained in:
Kenta420-Poom 2023-09-20 09:57:47 +07:00
parent 984707c7bf
commit 36c71eda38
31 changed files with 580 additions and 317 deletions

View file

@ -0,0 +1,31 @@
import { Injectable } from '@angular/core';
import {
HttpRequest,
HttpHandler,
HttpEvent,
HttpInterceptor,
HttpErrorResponse,
} from '@angular/common/http';
import { Observable, catchError, retry, throwError } from 'rxjs';
@Injectable()
export class ErrorInterceptor implements HttpInterceptor {
constructor() {}
intercept(
request: HttpRequest<unknown>,
next: HttpHandler
): Observable<HttpEvent<unknown>> {
return next.handle(request).pipe(
catchError((error) => {
if (error instanceof HttpErrorResponse) {
if (error.status === 401) {
return next.handle(request);
}
}
return throwError(() => error);
})
);
}
}