[Trunk|Library]: Fix CanLoad guards to get community from document(Can be used only in browser platform)

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@54960 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
k.triantafyllou 2019-03-04 13:23:01 +00:00
parent 8edba0b65c
commit ac0c8181e3
6 changed files with 7 additions and 6 deletions

View File

@ -50,7 +50,7 @@ export class ConnectAdminLoginGuard implements CanActivate, CanLoad {
}
canLoad(route: Route): Observable<boolean> | Promise<boolean> | boolean {
const path = '/' + route.path;
const path = '/' + route.path + document.location.search;
return this.check(ConnectHelper.getCommunityFromPath(path), path);
}
}

View File

@ -52,7 +52,7 @@ export class ConnectRIGuard implements CanActivate, CanLoad {
}
canLoad(route: Route): Observable<boolean> | Promise<boolean> | boolean {
const path = '/' + route.path;
const path = '/' + route.path + document.location.search;
return this.check(ConnectHelper.getCommunityFromPath(path), path);
}
}

View File

@ -41,7 +41,7 @@ export class ConnectSubscriberGuard implements CanActivate, CanLoad {
return this.check(route.queryParams['communityId'], state.url);
}
canLoad(route: Route): Observable<boolean> | Promise<boolean> | boolean {
const path = '/' + route.path;
const path = '/' + route.path + document.location.search;
return this.check(ConnectHelper.getCommunityFromPath(path), path);
}

View File

@ -30,7 +30,8 @@ export class IsCommunity implements CanActivate, CanLoad {
}
canLoad(route: Route): Observable<boolean> | Promise<boolean> | boolean {
const path = '/' + route.path;
const path = '/' + route.path + document.location.search;
console.log(path)
return this.check(ConnectHelper.getCommunityFromPath(path));
}
}

View File

@ -46,7 +46,7 @@ export class IsRouteEnabled implements CanActivate, CanLoad {
return this.check(route.data, route.queryParams['communityId'], state.url);
}
canLoad(route: Route): Observable<boolean> | Promise<boolean> | boolean {
const path = '/' + route;
const path = '/' + route.path + document.location.search;
return this.check(route.data, ConnectHelper.getCommunityFromPath(path), path);
}
}

View File

@ -9,7 +9,7 @@ export class PreviousRouteRecorder implements CanDeactivate<any> {
}
canDeactivate(component: any): Observable<boolean> | boolean {
if (typeof localStorage !== 'undefined') {
//console.log("In PreviousRouteRecorder : "+this.router.url );
// console.log("In PreviousRouteRecorder : "+this.router.url );
localStorage.setItem('previousRoute', this.router.url);
}
return true;