Merge branch 'feature/SUPPORT-9164' into develop
This commit is contained in:
commit
8440561dfe
6 changed files with 46 additions and 32 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue