fix: display data logic in claim toJSON

This commit is contained in:
Yarmo Mackenbach 2023-09-25 16:42:16 +02:00
parent c1cb3fcbb6
commit 7e5d15ac0f
No known key found for this signature in database
GPG key ID: 3C57D093219103A3

View file

@ -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
}
}
}