send the last JWT instead of the identifier for plan edits

This commit is contained in:
2024-02-11 16:05:15 -07:00
parent 5c547783a7
commit f41e541fe2
2 changed files with 8 additions and 5 deletions

View File

@@ -144,6 +144,7 @@ export interface PlanVerifiableCredential {
agent?: { identifier: string }; agent?: { identifier: string };
description?: string; description?: string;
identifier?: string; identifier?: string;
lastClaimId?: string;
location?: { location?: {
geo: { "@type": "GeoCoordinates"; latitude: number; longitude: number }; geo: { "@type": "GeoCoordinates"; latitude: number; longitude: number };
}; };

View File

@@ -171,6 +171,7 @@ export default class NewEditProjectView extends Vue {
includeLocation = false; includeLocation = false;
isHiddenSave = false; isHiddenSave = false;
isHiddenSpinner = true; isHiddenSpinner = true;
lastClaimJwtId = "";
latitude = 0; latitude = 0;
longitude = 0; longitude = 0;
numAccounts = 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.", "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 = const url =
this.apiServer + this.apiServer +
"/api/claim/byHandle/" + "/api/claim/byHandle/" +
@@ -245,6 +246,7 @@ export default class NewEditProjectView extends Vue {
if (resp.status === 200) { if (resp.status === 200) {
this.projectIssuerDid = resp.data.issuer; this.projectIssuerDid = resp.data.issuer;
this.fullClaim = resp.data.claim; this.fullClaim = resp.data.claim;
this.lastClaimJwtId = resp.data.id;
if (this.fullClaim?.location) { if (this.fullClaim?.location) {
this.includeLocation = true; this.includeLocation = true;
this.latitude = this.fullClaim.location.geo.latitude; 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 // Make a claim
const vcClaim: PlanVerifiableCredential = this.fullClaim; const vcClaim: PlanVerifiableCredential = this.fullClaim;
if (this.projectId) { if (this.projectId) {
vcClaim.identifier = this.projectId; vcClaim.lastClaimId = this.lastClaimJwtId;
} }
if (this.agentDid) { if (this.agentDid) {
vcClaim.agent = { vcClaim.agent = {
@@ -394,7 +396,7 @@ export default class NewEditProjectView extends Vue {
console.error("Error: there is no account."); console.error("Error: there is no account.");
} else { } else {
const identity = await this.getIdentity(this.activeDid); const identity = await this.getIdentity(this.activeDid);
this.SaveProject(identity); this.saveProject(identity);
} }
} }