|
|
@ -29,6 +29,23 @@ |
|
|
|
v-model="fullClaim.name" |
|
|
|
/> |
|
|
|
|
|
|
|
<input |
|
|
|
type="text" |
|
|
|
placeholder="Other Authorized Representative" |
|
|
|
class="block w-full rounded border border-slate-400 px-3 py-2" |
|
|
|
v-model="agentDid" |
|
|
|
/> |
|
|
|
<div class="mb-4"> |
|
|
|
<p v-if="activeDid != projectIssuerDid && agentDid != projectIssuerDid"> |
|
|
|
<span class="text-red-500">Beware!</span> |
|
|
|
If you save this, the original project owner will no longer be able to |
|
|
|
edit it. |
|
|
|
<button @click="agentDid = projectIssuerDid" class="text-blue-500"> |
|
|
|
Click here to make the original owner an authorized representative. |
|
|
|
</button> |
|
|
|
</p> |
|
|
|
</div> |
|
|
|
|
|
|
|
<textarea |
|
|
|
placeholder="Description" |
|
|
|
class="block w-full rounded border border-slate-400 mb-4 px-3 py-2" |
|
|
@ -57,8 +74,8 @@ |
|
|
|
</div> |
|
|
|
<div v-if="includeLocation" style="height: 600px; width: 800px"> |
|
|
|
<div class="px-2 py-2"> |
|
|
|
For your security, we recommend you choose a location nearby but not |
|
|
|
exactly at the place. |
|
|
|
For your security, choose a location nearby but not exactly at the |
|
|
|
place. |
|
|
|
</div> |
|
|
|
|
|
|
|
<l-map |
|
|
@ -98,7 +115,7 @@ |
|
|
|
<span :class="{ hidden: isHiddenSpinner }"> |
|
|
|
<!-- icon no worky? --> |
|
|
|
<i class="fa-solid fa-spinner fa-spin-pulse"></i> |
|
|
|
Saving…</span |
|
|
|
Saving...</span |
|
|
|
> |
|
|
|
</button> |
|
|
|
<button |
|
|
@ -141,6 +158,7 @@ export default class NewEditProjectView extends Vue { |
|
|
|
$notify!: (notification: Notification, timeout?: number) => void; |
|
|
|
|
|
|
|
activeDid = ""; |
|
|
|
agentDid = ""; |
|
|
|
apiServer = ""; |
|
|
|
errorMessage = ""; |
|
|
|
fullClaim: PlanVerifiableCredential = { |
|
|
@ -153,6 +171,7 @@ export default class NewEditProjectView extends Vue { |
|
|
|
latitude = 0; |
|
|
|
longitude = 0; |
|
|
|
numAccounts = 0; |
|
|
|
projectIssuerDid = ""; |
|
|
|
zoom = 2; |
|
|
|
|
|
|
|
async beforeCreate() { |
|
|
@ -224,12 +243,16 @@ export default class NewEditProjectView extends Vue { |
|
|
|
try { |
|
|
|
const resp = await this.axios.get(url, { headers }); |
|
|
|
if (resp.status === 200) { |
|
|
|
this.projectIssuerDid = resp.data.issuer; |
|
|
|
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; |
|
|
|
} |
|
|
|
if (this.fullClaim?.agent?.identifier) { |
|
|
|
this.agentDid = this.fullClaim.agent.identifier; |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (error) { |
|
|
|
console.error("Got error retrieving that project", error); |
|
|
@ -242,6 +265,11 @@ export default class NewEditProjectView extends Vue { |
|
|
|
if (this.projectId) { |
|
|
|
vcClaim.identifier = this.projectId; |
|
|
|
} |
|
|
|
if (this.agentDid) { |
|
|
|
vcClaim.agent = { |
|
|
|
identifier: this.agentDid, |
|
|
|
}; |
|
|
|
} |
|
|
|
if (this.includeLocation) { |
|
|
|
vcClaim.location = { |
|
|
|
geo: { |
|
|
@ -290,18 +318,15 @@ export default class NewEditProjectView extends Vue { |
|
|
|
|
|
|
|
// handleId is new in server v release-1.6.0; remove fullIri when that |
|
|
|
// version shows up here: https://api.endorser.ch/api-docs/ |
|
|
|
useAppStore().setProjectId( |
|
|
|
resp.data.success.handleId || resp.data.success.fullIri, |
|
|
|
); |
|
|
|
setTimeout( |
|
|
|
function (that: NewEditProjectView) { |
|
|
|
that.$router.push({ name: "project" }); |
|
|
|
}, |
|
|
|
2000, |
|
|
|
this, |
|
|
|
); |
|
|
|
useAppStore() |
|
|
|
.setProjectId( |
|
|
|
resp.data.success.handleId || resp.data.success.fullIri, |
|
|
|
) |
|
|
|
.then(() => { |
|
|
|
this.$router.push({ name: "project" }); |
|
|
|
}); |
|
|
|
} else { |
|
|
|
console.log( |
|
|
|
console.error( |
|
|
|
"Got unexpected 'data' inside response from server", |
|
|
|
resp, |
|
|
|
); |
|
|
@ -321,7 +346,7 @@ export default class NewEditProjectView extends Vue { |
|
|
|
error?: { message?: string }; |
|
|
|
}>; |
|
|
|
if (serverError) { |
|
|
|
console.log("Got error from server", serverError); |
|
|
|
console.error("Got error from server", serverError); |
|
|
|
if (Object.prototype.hasOwnProperty.call(serverError, "message")) { |
|
|
|
userMessage = serverError.response?.data?.error?.message || ""; // This is info for the user. |
|
|
|
this.$notify( |
|
|
|