mirror of
https://codeberg.org/keyoxide/doipjs.git
synced 2024-12-22 14:39:28 -07:00
feat: modify display object
This commit is contained in:
parent
34688bb644
commit
fc0af3dd1d
1 changed files with 9 additions and 6 deletions
15
src/claim.js
15
src/claim.js
|
@ -330,14 +330,16 @@ export class Claim {
|
|||
* @returns {object}
|
||||
*/
|
||||
toJSON () {
|
||||
let displayName = this._uri
|
||||
let displayUrl = null
|
||||
let displayProfileName = this._uri
|
||||
let displayProfileUrl = null
|
||||
let displayProofUrl = null
|
||||
let displayServiceProviderName = null
|
||||
let displayServiceProviderId = null
|
||||
|
||||
if (this._status >= ClaimStatus.MATCHED && this._matches.length > 0 && !this.isAmbiguous()) {
|
||||
displayName = this._matches[0].profile.display
|
||||
displayUrl = this._matches[0].profile.uri
|
||||
displayProfileName = this._matches[0].profile.display
|
||||
displayProfileUrl = this._matches[0].profile.uri
|
||||
displayProofUrl = this._matches[0].proof.request.uri
|
||||
displayServiceProviderName = this._matches[0].about.name
|
||||
displayServiceProviderId = this._matches[0].about.id
|
||||
}
|
||||
|
@ -349,8 +351,9 @@ export class Claim {
|
|||
matches: this._matches.map(x => x.toJSON()),
|
||||
status: this._status,
|
||||
display: {
|
||||
name: displayName,
|
||||
url: displayUrl,
|
||||
profileName: displayProfileName,
|
||||
profileUrl: displayProfileUrl,
|
||||
proofUrl: displayProofUrl,
|
||||
serviceProviderName: displayServiceProviderName,
|
||||
serviceProviderId: displayServiceProviderId
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue