Browse Source

send the last JWT instead of the identifier for plan edits

kb/add-usage-guide
Trent Larson 9 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 }; 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 };
}; };

12
src/views/NewEditProjectView.vue

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

Loading…
Cancel
Save