[Trunk | Library]: error/isRouteEnabled.guard.ts: Priority to get communityId from domain (if not exists, check url parameter or data)
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@56179 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
a40332b9cd
commit
726a9e2f10
|
@ -25,14 +25,15 @@ export class IsRouteEnabled implements CanActivate {
|
|||
|
||||
check(data: Data, community: string, path: string): Observable<boolean> | boolean {
|
||||
const customRedirect = data['redirect'];
|
||||
if (!community && data['community']) { // for openaire
|
||||
community = data['community'];
|
||||
}
|
||||
|
||||
const redirect = customRedirect ? customRedirect : '/error';
|
||||
const obs = this.propertiesService.subscribeEnvironment().pipe(map(res => {
|
||||
if (!community) {
|
||||
community = ConnectHelper.getCommunityFromDomain(res.domain);
|
||||
}
|
||||
if (!community && data['community']) { // for openaire or connect
|
||||
community = data['community'];
|
||||
}
|
||||
return res;
|
||||
}),mergeMap(prop => {
|
||||
if (!community) { // no community to check - return true
|
||||
|
|
Loading…
Reference in New Issue