Fix a bug in guards regarding deprecated method isLoggedIn
This commit is contained in:
parent
e6b2f41c8c
commit
d9a2f3b0ee
|
@ -22,23 +22,18 @@ export class LoginGuard implements CanActivate, CanLoad, CanActivateChild {
|
|||
}
|
||||
|
||||
check(path: string): Observable<boolean> | boolean {
|
||||
if (Session.isLoggedIn()) {
|
||||
return this.userManagementService.getUserInfo(false).pipe(map(user => {
|
||||
return user !== null;
|
||||
}),tap(isLoggedIn => {
|
||||
if(!isLoggedIn) {
|
||||
this.router.navigate(['/user-info'], {
|
||||
queryParams: {
|
||||
'errorCode': LoginErrorCodes.NOT_LOGIN,
|
||||
'redirectUrl': path
|
||||
}
|
||||
});
|
||||
}
|
||||
}));
|
||||
} else {
|
||||
this.router.navigate(['/user-info'], {queryParams: {'errorCode': LoginErrorCodes.NOT_LOGIN, 'redirectUrl':path}});
|
||||
return false;
|
||||
}
|
||||
return this.userManagementService.getUserInfo(false).pipe(map(user => {
|
||||
return user !== null;
|
||||
}),tap(isLoggedIn => {
|
||||
if(!isLoggedIn) {
|
||||
this.router.navigate(['/user-info'], {
|
||||
queryParams: {
|
||||
'errorCode': LoginErrorCodes.NOT_LOGIN,
|
||||
'redirectUrl': path
|
||||
}
|
||||
});
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
|
||||
|
|
|
@ -91,10 +91,7 @@ export class ResultPreviewComponent implements OnInit, OnChanges {
|
|||
getPID() {
|
||||
return Identifier.getResultPIDFromIdentifiers(this.result.identifiers);
|
||||
}
|
||||
get isLoggedIn(): boolean {
|
||||
return Session.isLoggedIn();
|
||||
}
|
||||
|
||||
|
||||
public initBeforeTitle() {
|
||||
if(this.result.resultType && this.result.resultType !== 'dataprovider') {
|
||||
this.type = this.getTypeName(this.result.resultType);
|
||||
|
|
Loading…
Reference in New Issue