Browse Source

send the last JWT instead of the identifier for plan edits

starred-projects
Trent Larson 7 months ago
parent
commit
f41e541fe2
  1. 1
      src/libs/endorserServer.ts
  2. 12
      src/views/NewEditProjectView.vue

1
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 };
};

12
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);
}
}

Loading…
Cancel
Save