From 9a2fdef3dc22b3163ab08af1ab7115aff80d4cd5 Mon Sep 17 00:00:00 2001 From: kochetkov Date: Mon, 12 May 2025 11:07:17 +0300 Subject: [PATCH] SUPPORT-9164 add progress bar --- frontend/src/ts/modules/security/guard/auth.guard.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/frontend/src/ts/modules/security/guard/auth.guard.ts b/frontend/src/ts/modules/security/guard/auth.guard.ts index fb1b936..427904d 100644 --- a/frontend/src/ts/modules/security/guard/auth.guard.ts +++ b/frontend/src/ts/modules/security/guard/auth.guard.ts @@ -2,7 +2,7 @@ import {Injectable} from "@angular/core"; import {ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot} from "@angular/router"; import {Observable} from "rxjs"; import {HttpClient, HttpParams} from "@angular/common/http"; -import {MessagesService} from "@webbpm/base-package"; +import {MessagesService, ProgressIndicationService} from "@webbpm/base-package"; import {AuthenticationService} from "../authentication.service"; import {EsiaErrorDetail} from "../EsiaErrorDetail"; @@ -13,6 +13,7 @@ export abstract class AuthGuard implements CanActivate { protected router: Router, private httpClient: HttpClient, private authenticationService: AuthenticationService, + private progressIndicationService: ProgressIndicationService, private messageService: MessagesService ) { } @@ -44,6 +45,7 @@ export abstract class AuthGuard implements CanActivate { return false; } if (code && state) { + this.progressIndicationService.showProgressBar(); const params = new HttpParams().set('code', code).set('state', state); this.httpClient.get("esia/auth", { @@ -57,6 +59,7 @@ export abstract class AuthGuard implements CanActivate { .toPromise() .then( () => { + this.progressIndicationService.hideProgressBar(); window.open(url.origin + url.pathname, "_self"); }) .catch(reason => { @@ -64,7 +67,8 @@ export abstract class AuthGuard implements CanActivate { json.messages.forEach((errorMessage) => { this.messageService.error(errorMessage, json); }) - }); + }) + .finally(() => this.progressIndicationService.hideProgressBar()); return false; } else {