[MNT-21636] Use URLTree for redirect (#6691)

* use URLTree for redirect

* use always urltree

* fix e2e

* fix
This commit is contained in:
Eugenio Romano
2021-02-18 17:42:57 +00:00
committed by GitHub
parent 81f9f482b2
commit 4a381b46a5
8 changed files with 49 additions and 83 deletions

View File

@@ -75,12 +75,12 @@ export abstract class AuthGuardBase implements CanActivate, CanActivateChild {
return this.canActivate(route, state);
}
protected async redirectSSOSuccessURL(): Promise<boolean> {
protected async redirectSSOSuccessURL(): Promise<boolean | UrlTree> {
const redirectFragment = this.storageService.getItem('loginFragment');
if (redirectFragment && this.getLoginRoute() !== redirectFragment) {
this.storageService.removeItem('loginFragment');
return this.navigate(redirectFragment);
return this.router.parseUrl(redirectFragment);
}
return true;
@@ -90,7 +90,7 @@ export abstract class AuthGuardBase implements CanActivate, CanActivateChild {
return !!this.storageService.getItem('loginFragment');
}
protected async redirectToUrl(url: string): Promise<boolean> {
protected async redirectToUrl(url: string): Promise<boolean | UrlTree> {
let urlToRedirect = `/${this.getLoginRoute()}`;
if (!this.authenticationService.isOauth()) {
@@ -110,9 +110,9 @@ export abstract class AuthGuardBase implements CanActivate, CanActivateChild {
return false;
}
protected navigate(url: string): Promise<boolean> {
protected navigate(url: string): UrlTree {
this.dialog.closeAll();
return this.router.navigateByUrl(url);
return this.router.parseUrl(url);
}
protected getOauthConfig(): OauthConfigModel {