From 217e5b6fa706c4c0c05ba10fcbc722c1e7a0726b Mon Sep 17 00:00:00 2001 From: George Nash Date: Mon, 3 Jun 2024 14:29:41 +0100 Subject: [PATCH] added logging --- .../app/landing-page/landing-page.component.html | 4 ++-- ui/src/app/landing-page/landing-page.component.ts | 15 +++++++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/ui/src/app/landing-page/landing-page.component.html b/ui/src/app/landing-page/landing-page.component.html index 55113a0cd..1da355530 100644 --- a/ui/src/app/landing-page/landing-page.component.html +++ b/ui/src/app/landing-page/landing-page.component.html @@ -18,8 +18,8 @@

orcid-logo - {{ issuer }}/{{ orcidRecord.orcid }} -

+ {{ issuer }}/{{ orcidRecord?.orcid }} +

{{ incorrectDataMessage }}

diff --git a/ui/src/app/landing-page/landing-page.component.ts b/ui/src/app/landing-page/landing-page.component.ts index 49e069fd4..478ab4b8d 100644 --- a/ui/src/app/landing-page/landing-page.component.ts +++ b/ui/src/app/landing-page/landing-page.component.ts @@ -7,6 +7,7 @@ import { MemberService } from '../member/service/member.service' import { IMember } from '../member/model/member.model' import { ORCID_BASE_URL } from '../app.constants' import { WindowLocationService } from '../shared/service/window-location.service' +import { OrcidRecord } from '../shared/model/orcid-record.model' @Component({ selector: 'app-landing-page', @@ -27,9 +28,8 @@ export class LandingPageComponent implements OnInit { clientName: string | undefined salesforceId: string | undefined clientId: string | undefined - orcidId: string | undefined oauthUrl: string | undefined - orcidRecord: any + orcidRecord: OrcidRecord | undefined signedInIdToken: any givenName: string | undefined familyName: string | undefined @@ -58,11 +58,17 @@ export class LandingPageComponent implements OnInit { } processRequest(state_param: string, id_token_fragment: string, access_token_fragment: string) { + console.log('process request method, calling this.landingPageService.getOrcidConnectionRecord') + this.landingPageService.getOrcidConnectionRecord(state_param).subscribe({ next: (result) => { + console.log('got orcid record result: ', result) + this.orcidRecord = result this.landingPageService.getMemberInfo(state_param).subscribe({ next: (res: IMember) => { + console.log('got member data') + this.clientName = res.clientName this.clientId = res.clientId this.salesforceId = res.salesforceId @@ -82,6 +88,8 @@ export class LandingPageComponent implements OnInit { // Check if id token exists in URL (user just granted permission) if (id_token_fragment != null && id_token_fragment !== '') { + console.log('checking submit token') + this.checkSubmitToken(id_token_fragment, state_param, access_token_fragment) } else { const error = this.getFragmentParameterByName('error') @@ -154,6 +162,9 @@ export class LandingPageComponent implements OnInit { return } if (data.isSameUserThatAlreadyGranted) { + console.log('same user has already granted access. this.orcidRecord is ', this.orcidRecord) + console.log('this.orcidRecord.orcidId is ', this.orcidRecord?.orcid) + this.showConnectionExistsElement() return }