From f41e541fe273a8e687a2bb596942a0da212591f0 Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Sun, 11 Feb 2024 16:05:15 -0700 Subject: [PATCH] send the last JWT instead of the identifier for plan edits --- src/libs/endorserServer.ts | 1 + src/views/NewEditProjectView.vue | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/libs/endorserServer.ts b/src/libs/endorserServer.ts index b55981d..c2168fe 100644 --- a/src/libs/endorserServer.ts +++ b/src/libs/endorserServer.ts @@ -144,6 +144,7 @@ export interface PlanVerifiableCredential { agent?: { identifier: string }; description?: string; identifier?: string; + lastClaimId?: string; location?: { geo: { "@type": "GeoCoordinates"; latitude: number; longitude: number }; }; diff --git a/src/views/NewEditProjectView.vue b/src/views/NewEditProjectView.vue index f3a4010..9cf9058 100644 --- a/src/views/NewEditProjectView.vue +++ b/src/views/NewEditProjectView.vue @@ -171,6 +171,7 @@ export default class NewEditProjectView extends Vue { includeLocation = false; isHiddenSave = false; isHiddenSpinner = true; + lastClaimJwtId = ""; latitude = 0; longitude = 0; numAccounts = 0; @@ -224,12 +225,12 @@ export default class NewEditProjectView extends Vue { "An ID is chosen but there are no keys for it so it cannot be used to talk with the service. Switch your ID.", ); } - this.LoadProject(identity); + this.loadProject(identity); } } } - async LoadProject(identity: IIdentifier) { + async loadProject(identity: IIdentifier) { const url = this.apiServer + "/api/claim/byHandle/" + @@ -245,6 +246,7 @@ export default class NewEditProjectView extends Vue { if (resp.status === 200) { this.projectIssuerDid = resp.data.issuer; this.fullClaim = resp.data.claim; + this.lastClaimJwtId = resp.data.id; if (this.fullClaim?.location) { this.includeLocation = true; this.latitude = this.fullClaim.location.geo.latitude; @@ -259,11 +261,11 @@ export default class NewEditProjectView extends Vue { } } - private async SaveProject(identity: IIdentifier) { + private async saveProject(identity: IIdentifier) { // Make a claim const vcClaim: PlanVerifiableCredential = this.fullClaim; if (this.projectId) { - vcClaim.identifier = this.projectId; + vcClaim.lastClaimId = this.lastClaimJwtId; } if (this.agentDid) { vcClaim.agent = { @@ -394,7 +396,7 @@ export default class NewEditProjectView extends Vue { console.error("Error: there is no account."); } else { const identity = await this.getIdentity(this.activeDid); - this.SaveProject(identity); + this.saveProject(identity); } }