diff --git a/frontend/src/ts/modules/security/authentication.service.ts b/frontend/src/ts/modules/security/authentication.service.ts index ec5d5a4..650acd2 100644 --- a/frontend/src/ts/modules/security/authentication.service.ts +++ b/frontend/src/ts/modules/security/authentication.service.ts @@ -2,6 +2,7 @@ import {Injectable} from '@angular/core'; import {HttpClient} from '@angular/common/http'; import {CookieService} from "ngx-cookie"; import {AppConfigService} from "@webbpm/base-package"; +import {map, tap} from "rxjs/operators"; @Injectable({providedIn: 'root'}) export class AuthenticationService { @@ -24,11 +25,11 @@ export class AuthenticationService { } public redirectToEsia() { - return this.http.get("esia/url") - .toPromise() - .then(url => { + return this.http.get("esia/url").pipe( + tap(url => { window.open(url, "_self"); - return true; - }); + }), + map(() => true) + ); } } diff --git a/frontend/src/ts/modules/security/guard/auth.guard.ts b/frontend/src/ts/modules/security/guard/auth.guard.ts index 0e8300a..f832f9b 100644 --- a/frontend/src/ts/modules/security/guard/auth.guard.ts +++ b/frontend/src/ts/modules/security/guard/auth.guard.ts @@ -65,7 +65,7 @@ export abstract class AuthGuard implements CanActivate { return false; } else { - return this.authenticationService.redirectToEsia().catch((reason) => { + return this.authenticationService.redirectToEsia().toPromise().catch((reason) => { console.error(reason); return false; }); diff --git a/frontend/src/ts/modules/webbpm/interceptor/ervu-http-security-error-interceptor.ts b/frontend/src/ts/modules/webbpm/interceptor/ervu-http-security-error-interceptor.ts index 27f3ace..2abdfc4 100644 --- a/frontend/src/ts/modules/webbpm/interceptor/ervu-http-security-error-interceptor.ts +++ b/frontend/src/ts/modules/webbpm/interceptor/ervu-http-security-error-interceptor.ts @@ -11,8 +11,8 @@ import { } from "@webbpm/base-package"; import {Injectable} from "@angular/core"; import {Router} from "@angular/router"; -import {from, Observable} from "rxjs"; -import {catchError, map} from "rxjs/operators"; +import {EMPTY, from, Observable} from "rxjs"; +import {catchError, map, switchMap} from "rxjs/operators"; import {AuthenticationService} from "../../security/authentication.service"; @Injectable()