Browse Source

fix project loading & saving to include all the claim data

pull/89/head
Trent Larson 12 months ago
parent
commit
3f436476a2
  1. 1
      project.task.yaml
  2. 35
      src/views/NewEditProjectView.vue
  3. 2
      src/views/ProjectViewView.vue

1
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?

35
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"
/>
<textarea
placeholder="Description"
class="block w-full rounded border border-slate-400 mb-4 px-3 py-2"
rows="5"
v-model="description"
v-model="fullClaim.description"
maxlength="5000"
></textarea>
<div class="text-xs text-slate-500 italic -mt-3 mb-4">
{{ description.length }}/5000 max. characters
{{ fullClaim.description.length }}/5000 max. characters
</div>
<div class="flex items-center mb-4">
@ -72,7 +72,7 @@
name="OpenStreetMap"
/>
<l-marker
v-if="latitude || longitude"
v-if="latitude && longitude"
:lat-lng="[latitude, longitude]"
@click="maybeEraseLatLong()"
/>
@ -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(
{

2
src/views/ProjectViewView.vue

@ -35,7 +35,7 @@
<fa icon="user" class="fa-fw text-slate-400"></fa>
{{ issuer }}
</div>
<div>
<div v-if="timeSince">
<fa icon="calendar" class="fa-fw text-slate-400"></fa>
{{ timeSince }}
</div>

Loading…
Cancel
Save