[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:
konstantina.galouni 2019-06-24 11:05:24 +00:00
parent a40332b9cd
commit 726a9e2f10
1 changed files with 4 additions and 3 deletions

View File

@ -25,14 +25,15 @@ export class IsRouteEnabled implements CanActivate {
check(data: Data, community: string, path: string): Observable<boolean> | boolean { check(data: Data, community: string, path: string): Observable<boolean> | boolean {
const customRedirect = data['redirect']; const customRedirect = data['redirect'];
if (!community && data['community']) { // for openaire
community = data['community'];
}
const redirect = customRedirect ? customRedirect : '/error'; const redirect = customRedirect ? customRedirect : '/error';
const obs = this.propertiesService.subscribeEnvironment().pipe(map(res => { const obs = this.propertiesService.subscribeEnvironment().pipe(map(res => {
if (!community) { if (!community) {
community = ConnectHelper.getCommunityFromDomain(res.domain); community = ConnectHelper.getCommunityFromDomain(res.domain);
} }
if (!community && data['community']) { // for openaire or connect
community = data['community'];
}
return res; return res;
}),mergeMap(prop => { }),mergeMap(prop => {
if (!community) { // no community to check - return true if (!community) { // no community to check - return true