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