From 59d0772881688dacfad976e0d547755f95cf3d42 Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Fri, 8 Dec 2023 14:13:23 -0700 Subject: [PATCH] ask for confirmation before submitting a confirm claim --- src/views/ClaimView.vue | 88 +++++++++++++++++++++-------------------- 1 file changed, 45 insertions(+), 43 deletions(-) diff --git a/src/views/ClaimView.vue b/src/views/ClaimView.vue index 42e6d35..34b4310 100644 --- a/src/views/ClaimView.vue +++ b/src/views/ClaimView.vue @@ -121,7 +121,7 @@ You have confirmed this claim.
- You cannot confirm this claim because it contains a DID that is hidden + You cannot confirm this claim because it contains data that is hidden from you.
@@ -419,51 +419,53 @@ export default class ClaimView extends Vue { } async confirmClaim() { - // similar logic is found in endorser-mobile - const goodClaim = serverUtil.removeSchemaContext( - serverUtil.removeVisibleToDids( - serverUtil.addLastClaimOrHandleAsIdIfMissing( - this.veriClaim.claim, - this.veriClaim.id, - this.veriClaim.handleId, + if (confirm("Do you personally confirm that this is true?")) { + // similar logic is found in endorser-mobile + const goodClaim = serverUtil.removeSchemaContext( + serverUtil.removeVisibleToDids( + serverUtil.addLastClaimOrHandleAsIdIfMissing( + this.veriClaim.claim, + this.veriClaim.id, + this.veriClaim.handleId, + ), ), - ), - ); - const confirmationClaim: serverUtil.GenericVerifiableCredential & { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - object: any; - } = { - "@context": "https://schema.org", - "@type": "AgreeAction", - object: goodClaim, - }; - const result = await serverUtil.createAndSubmitClaim( - confirmationClaim, - await this.getIdentity(this.activeDid), - this.apiServer, - this.axios, - ); - if (result.type === "success") { - this.$notify( - { - group: "alert", - type: "success", - title: "Success", - text: "Confirmation submitted.", - }, - 5000, ); - } else { - console.log("Got error submitting the confirmation:", result); - this.$notify( - { - group: "alert", - type: "danger", - title: "Error", - text: "There was a problem submitting the confirmation. See logs for more info.", - }, - -1, + const confirmationClaim: serverUtil.GenericVerifiableCredential & { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + object: any; + } = { + "@context": "https://schema.org", + "@type": "AgreeAction", + object: goodClaim, + }; + const result = await serverUtil.createAndSubmitClaim( + confirmationClaim, + await this.getIdentity(this.activeDid), + this.apiServer, + this.axios, ); + if (result.type === "success") { + this.$notify( + { + group: "alert", + type: "success", + title: "Success", + text: "Confirmation submitted.", + }, + 5000, + ); + } else { + console.log("Got error submitting the confirmation:", result); + this.$notify( + { + group: "alert", + type: "danger", + title: "Error", + text: "There was a problem submitting the confirmation. See logs for more info.", + }, + -1, + ); + } } } }