From 726a9e2f10840fe2fc237b87327d2831c40298a4 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Mon, 24 Jun 2019 11:05:24 +0000 Subject: [PATCH] [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 --- error/isRouteEnabled.guard.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/error/isRouteEnabled.guard.ts b/error/isRouteEnabled.guard.ts index f65b488a..44f272bf 100644 --- a/error/isRouteEnabled.guard.ts +++ b/error/isRouteEnabled.guard.ts @@ -25,14 +25,15 @@ export class IsRouteEnabled implements CanActivate { check(data: Data, community: string, path: string): Observable | 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