From 3f436476a2183400af2d1868941be9b1a0c46627 Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Tue, 5 Dec 2023 18:47:56 -0700 Subject: [PATCH] fix project loading & saving to include all the claim data --- project.task.yaml | 1 + src/views/NewEditProjectView.vue | 35 ++++++++++++++++---------------- src/views/ProjectViewView.vue | 2 +- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/project.task.yaml b/project.task.yaml index c0bc9f8..828b340 100644 --- a/project.task.yaml +++ b/project.task.yaml @@ -17,6 +17,7 @@ tasks: - .5 make a VC details page, or link to endorser.ch (including confirmations) - .3 Add URL for project +- .5 Add start date to project - 01 allow download of each VC (& confirmations, to show that they actually own their data) - .3 check that Android shows "back" buttons on screens without bottom tray - .1 Make give description text box into something that expands as they type? diff --git a/src/views/NewEditProjectView.vue b/src/views/NewEditProjectView.vue index 62d5c71..ec8f56e 100644 --- a/src/views/NewEditProjectView.vue +++ b/src/views/NewEditProjectView.vue @@ -26,18 +26,18 @@ type="text" placeholder="Idea Name" class="block w-full rounded border border-slate-400 mb-4 px-3 py-2" - v-model="projectName" + v-model="fullClaim.name" />
- {{ description.length }}/5000 max. characters + {{ fullClaim.description.length }}/5000 max. characters
@@ -72,7 +72,7 @@ name="OpenStreetMap" /> @@ -136,13 +136,17 @@ export default class NewEditProjectView extends Vue { activeDid = ""; apiServer = ""; - description = ""; errorMessage = ""; + fullClaim: PlanVerifiableCredential = { + "@context": "https://schema.org", + "@type": "PlanAction", + name: "", + description: "", + }; includeLocation = false; latitude = 0; longitude = 0; numAccounts = 0; - projectName = ""; zoom = 2; async beforeCreate() { @@ -214,9 +218,12 @@ export default class NewEditProjectView extends Vue { try { const resp = await this.axios.get(url, { headers }); if (resp.status === 200) { - const claim = resp.data.claim; - this.projectName = claim.name; - this.description = claim.description; + this.fullClaim = resp.data.claim; + if (this.fullClaim?.location) { + this.includeLocation = true; + this.latitude = this.fullClaim.location.geo.latitude; + this.longitude = this.fullClaim.location.geo.longitude; + } } } catch (error) { console.error("Got error retrieving that project", error); @@ -225,13 +232,7 @@ export default class NewEditProjectView extends Vue { private async SaveProject(identity: IIdentifier) { // Make a claim - const vcClaim: PlanVerifiableCredential = { - "@context": "https://schema.org", - "@type": "PlanAction", - name: this.projectName, - description: this.description, - identifier: this.projectId || undefined, - }; + const vcClaim: PlanVerifiableCredential = this.fullClaim; if (this.projectId) { vcClaim.identifier = this.projectId; } @@ -314,8 +315,8 @@ export default class NewEditProjectView extends Vue { error?: { message?: string }; }>; if (serverError) { + console.log("Got error from server", serverError); if (Object.prototype.hasOwnProperty.call(serverError, "message")) { - console.log(serverError); userMessage = serverError.response?.data?.error?.message || ""; // This is info for the user. this.$notify( { diff --git a/src/views/ProjectViewView.vue b/src/views/ProjectViewView.vue index 6232592..8226f24 100644 --- a/src/views/ProjectViewView.vue +++ b/src/views/ProjectViewView.vue @@ -35,7 +35,7 @@ {{ issuer }}
-
+
{{ timeSince }}