RED-6893: Stop loading after error is handled.
This commit is contained in:
parent
bfaae5adf6
commit
a6383c1dbc
@ -8,13 +8,12 @@ import {
|
||||
HttpStatusCode,
|
||||
} from '@angular/common/http';
|
||||
import { Inject, Injectable, Optional } from '@angular/core';
|
||||
import { MonoTypeOperatorFunction, Observable, retry, throwError, timer } from 'rxjs';
|
||||
import { finalize, MonoTypeOperatorFunction, Observable, retry, throwError, timer } from 'rxjs';
|
||||
import { catchError, tap } from 'rxjs/operators';
|
||||
import { MAX_RETRIES_ON_SERVER_ERROR, SERVER_ERROR_SKIP_PATHS } from './tokens';
|
||||
import { ErrorService } from './error.service';
|
||||
import { KeycloakService } from 'keycloak-angular';
|
||||
import { IqserConfigService } from '../services';
|
||||
import { KeycloakStatusService } from '../tenants';
|
||||
import { LoadingService } from '../loading';
|
||||
|
||||
function updateSeconds(seconds: number) {
|
||||
if (seconds === 0 || seconds === 1) {
|
||||
@ -56,8 +55,7 @@ export class ServerErrorInterceptor implements HttpInterceptor {
|
||||
|
||||
constructor(
|
||||
private readonly _errorService: ErrorService,
|
||||
private readonly _keycloakService: KeycloakService,
|
||||
private readonly _configService: IqserConfigService,
|
||||
private readonly _loadingService: LoadingService,
|
||||
private readonly _keycloakStatusService: KeycloakStatusService,
|
||||
@Optional() @Inject(MAX_RETRIES_ON_SERVER_ERROR) private readonly _maxRetries: number,
|
||||
@Optional() @Inject(SERVER_ERROR_SKIP_PATHS) private readonly _skippedPaths: string[],
|
||||
@ -84,7 +82,11 @@ export class ServerErrorInterceptor implements HttpInterceptor {
|
||||
this._urlsWithError.add(req.url);
|
||||
}
|
||||
|
||||
return throwError(() => error);
|
||||
return throwError(() => error).pipe(
|
||||
finalize(() => {
|
||||
this._loadingService.stop();
|
||||
}),
|
||||
);
|
||||
}),
|
||||
backoffOnServerError(this._maxRetries, this._skippedPaths),
|
||||
);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user