feat: modify display object

This commit is contained in:
Yarmo Mackenbach 2023-10-04 09:11:02 +02:00
parent 34688bb644
commit fc0af3dd1d
No known key found for this signature in database
GPG key ID: 3C57D093219103A3

View file

@ -330,14 +330,16 @@ export class Claim {
* @returns {object} * @returns {object}
*/ */
toJSON () { toJSON () {
let displayName = this._uri let displayProfileName = this._uri
let displayUrl = null let displayProfileUrl = null
let displayProofUrl = null
let displayServiceProviderName = null let displayServiceProviderName = null
let displayServiceProviderId = null let displayServiceProviderId = null
if (this._status >= ClaimStatus.MATCHED && this._matches.length > 0 && !this.isAmbiguous()) { if (this._status >= ClaimStatus.MATCHED && this._matches.length > 0 && !this.isAmbiguous()) {
displayName = this._matches[0].profile.display displayProfileName = this._matches[0].profile.display
displayUrl = this._matches[0].profile.uri displayProfileUrl = this._matches[0].profile.uri
displayProofUrl = this._matches[0].proof.request.uri
displayServiceProviderName = this._matches[0].about.name displayServiceProviderName = this._matches[0].about.name
displayServiceProviderId = this._matches[0].about.id displayServiceProviderId = this._matches[0].about.id
} }
@ -349,8 +351,9 @@ export class Claim {
matches: this._matches.map(x => x.toJSON()), matches: this._matches.map(x => x.toJSON()),
status: this._status, status: this._status,
display: { display: {
name: displayName, profileName: displayProfileName,
url: displayUrl, profileUrl: displayProfileUrl,
proofUrl: displayProofUrl,
serviceProviderName: displayServiceProviderName, serviceProviderName: displayServiceProviderName,
serviceProviderId: displayServiceProviderId serviceProviderId: displayServiceProviderId
} }