Skip to content
Snippets Groups Projects
Commit ed34840e authored by OZGCloud's avatar OZGCloud
Browse files

OZG-961 code refactoring

parent a5c0d3c0
Branches
Tags
No related merge requests found
...@@ -19,7 +19,7 @@ export class HttpErrorInterceptor implements HttpInterceptor { ...@@ -19,7 +19,7 @@ export class HttpErrorInterceptor implements HttpInterceptor {
intercept(req: HttpRequest<any>, httpHandler: HttpHandler): Observable<HttpEvent<any>> { intercept(req: HttpRequest<any>, httpHandler: HttpHandler): Observable<HttpEvent<any>> {
return httpHandler.handle(req).pipe( return httpHandler.handle(req).pipe(
catchError((error: HttpErrorResponse, caught) => { catchError((error: HttpErrorResponse, caught) => {
if (error.status >= 500 && error.status < 600) { if (this.isErrorIn500Range(error)) {
this.dialog.open(InternalServerErrorDialogComponent, this.dialogConfig) this.dialog.open(InternalServerErrorDialogComponent, this.dialogConfig)
} else if (error.status === 401) { } else if (error.status === 401) {
this.reloadWindow(); this.reloadWindow();
...@@ -32,4 +32,8 @@ export class HttpErrorInterceptor implements HttpInterceptor { ...@@ -32,4 +32,8 @@ export class HttpErrorInterceptor implements HttpInterceptor {
reloadWindow(): void { reloadWindow(): void {
window.location.reload(); window.location.reload();
} }
private isErrorIn500Range(error: HttpErrorResponse): boolean {
return error.status >= 500 && error.status < 600;
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment