mirror of
https://codeberg.org/keyoxide/doipjs.git
synced 2024-12-22 22:49:28 -07:00
fix: display data logic in claim toJSON
This commit is contained in:
parent
c1cb3fcbb6
commit
7e5d15ac0f
1 changed files with 5 additions and 6 deletions
11
src/claim.js
11
src/claim.js
|
@ -332,15 +332,13 @@ export class Claim {
|
||||||
let displayName = this._uri
|
let displayName = this._uri
|
||||||
let displayUrl = null
|
let displayUrl = null
|
||||||
let displayServiceProviderName = null
|
let displayServiceProviderName = null
|
||||||
|
let displayServiceProviderId = null
|
||||||
|
|
||||||
if (this._status >= 200 && this._status < 300) {
|
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
|
|
||||||
} else if (this._status === ClaimStatus.MATCHED && !this.isAmbiguous()) {
|
|
||||||
displayName = this._matches[0].profile.display
|
displayName = this._matches[0].profile.display
|
||||||
displayUrl = this._matches[0].profile.uri
|
displayUrl = this._matches[0].profile.uri
|
||||||
displayServiceProviderName = this._matches[0].about.name
|
displayServiceProviderName = this._matches[0].about.name
|
||||||
|
displayServiceProviderId = this._matches[0].about.id
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -352,7 +350,8 @@ export class Claim {
|
||||||
display: {
|
display: {
|
||||||
name: displayName,
|
name: displayName,
|
||||||
url: displayUrl,
|
url: displayUrl,
|
||||||
serviceProviderName: displayServiceProviderName
|
serviceProviderName: displayServiceProviderName,
|
||||||
|
serviceProviderId: displayServiceProviderId
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue