From 7e5d15ac0ffd2b6a6c870147f748966f86308d46 Mon Sep 17 00:00:00 2001 From: Yarmo Mackenbach Date: Mon, 25 Sep 2023 16:42:16 +0200 Subject: [PATCH] fix: display data logic in claim toJSON --- src/claim.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/claim.js b/src/claim.js index 3318f01..b900f4e 100644 --- a/src/claim.js +++ b/src/claim.js @@ -332,15 +332,13 @@ export class Claim { let displayName = this._uri let displayUrl = null let displayServiceProviderName = null + let displayServiceProviderId = null - if (this._status >= 200 && this._status < 300) { - displayName = this._matches[0].profile.display - displayUrl = this._matches[0].profile.uri - displayServiceProviderName = this._matches[0].about.name - } else if (this._status === ClaimStatus.MATCHED && !this.isAmbiguous()) { + if (!this.isAmbiguous() || (this._status >= 200 && this._status < 300)) { displayName = this._matches[0].profile.display displayUrl = this._matches[0].profile.uri displayServiceProviderName = this._matches[0].about.name + displayServiceProviderId = this._matches[0].about.id } return { @@ -352,7 +350,8 @@ export class Claim { display: { name: displayName, url: displayUrl, - serviceProviderName: displayServiceProviderName + serviceProviderName: displayServiceProviderName, + serviceProviderId: displayServiceProviderId } } }