From ed5f31cb7b489d75653c242717dc6112ded8f1c3 Mon Sep 17 00:00:00 2001 From: "argiro.kokogiannaki" Date: Mon, 15 Feb 2021 13:19:33 +0000 Subject: [PATCH] [Library|Trunk] - Error interceptor add check for registry url - landing canonical: keep the canonical id (to be used in services like usage counts) and put the 1st pid for the canonical url git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@60422 d315682c-612b-4755-9ff5-7f18f6832af3 --- claims/myClaims/myClaims.component.ts | 2 +- error-interceptor.service.ts | 2 +- landingPages/result/resultLanding.component.ts | 4 +++- landingPages/result/resultLanding.service.ts | 5 +---- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/claims/myClaims/myClaims.component.ts b/claims/myClaims/myClaims.component.ts index ef2fceb2..43ebeb59 100644 --- a/claims/myClaims/myClaims.component.ts +++ b/claims/myClaims/myClaims.component.ts @@ -12,7 +12,7 @@ import {Subscriber} from "rxjs";
-
+
My links
diff --git a/error-interceptor.service.ts b/error-interceptor.service.ts index 4f50184d..72da0615 100644 --- a/error-interceptor.service.ts +++ b/error-interceptor.service.ts @@ -18,7 +18,7 @@ export class ErrorInterceptorService implements HttpInterceptor { intercept(req: HttpRequest, next: HttpHandler): Observable> { return next.handle(req).pipe(catchError(err => { - if ((err.status === 0 && this.isService(req, properties.registryUrl)) || + if ((err.status === 0 && properties.registryUrl && this.isService(req, properties.registryUrl)) || (err.status === 401 && !this.isService(req, ErrorInterceptorService.UNAUTHORIZED_WHITELIST))) { this.logOut(); } else if(err.status === 403) { diff --git a/landingPages/result/resultLanding.component.ts b/landingPages/result/resultLanding.component.ts index e15059d5..7e65e77e 100644 --- a/landingPages/result/resultLanding.component.ts +++ b/landingPages/result/resultLanding.component.ts @@ -356,7 +356,9 @@ export class ResultLandingComponent { if (this.type == "result") { // no type was specified - update URL based this.resultLandingInfo.resultType this.updateUrlWithType(); } - this.seoService.createLinkForCanonicalURL(this.properties.domain+ properties.baseLink + this.linkToLandingPage + this.resultLandingInfo.relcanId); + let pid:Identifier = Identifier.getResultPIDFromIdentifiers(this.resultLandingInfo.identifiers); + this.seoService.createLinkForCanonicalURL(this.properties.domain+ properties.baseLink + ( pid ? (this.linkToLandingPage.split("?")[0] + "?pid=" + pid.id): + (this.linkToLandingPage + this.resultLandingInfo.relcanId))); if ((this.type == "publication") && (this.properties.environment == "beta" || this.properties.environment == "development") && (typeof document !== 'undefined')) { this.getOpenCitations(); } diff --git a/landingPages/result/resultLanding.service.ts b/landingPages/result/resultLanding.service.ts index a52d6db1..7acb5a97 100644 --- a/landingPages/result/resultLanding.service.ts +++ b/landingPages/result/resultLanding.service.ts @@ -269,10 +269,7 @@ export class ResultLandingService { if(data[4] != null) { this.resultLandingInfo.identifiers = this.parsingFunctions.parseIdentifiers(data[4]); } - let pid:Identifier = Identifier.getResultPIDFromIdentifiers(this.resultLandingInfo.identifiers); - if(pid){ - this.resultLandingInfo.relcanId = encodeURIComponent(pid.id); - } + // res['result']['metadata']['oaf:entity']['oaf:result']['journal'] if(data[5] != null) { this.resultLandingInfo.journal = {"journal": "", "issn": "", "lissn": "", "eissn": "", "issue": "", "volume": "", "start_page": "", "end_page": ""}