Skip to content

Commit

Permalink
prompt for signature when the cart widget is clicked
Browse files Browse the repository at this point in the history
  • Loading branch information
yuetloo committed Jun 1, 2023
1 parent 90b25fd commit 3415a01
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion vue-app/src/components/CartWidget.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
<script setup lang="ts">
import { computed } from 'vue'
import Cart from '@/components/Cart.vue'
import { useModal } from 'vue-final-modal'
import SignatureModal from '@/components/SignatureModal.vue'
import { useAppStore, useUserStore } from '@/stores'
import { storeToRefs } from 'pinia'
Expand All @@ -43,8 +46,24 @@ const isCartBadgeShown = computed(() => {
return (canUserReallocate.value || isRoundContributionPhase.value) && !!cart.value.length
})
async function promptSignagure() {
const { open, close } = useModal({
component: SignatureModal,
attrs: {
onClose() {
close().then(() => {
appStore.toggleShowCartPanel()
})
},
},
})
open()
}
function toggleCart(): void {
appStore.toggleShowCartPanel()
if (currentUser.value && !currentUser.value.encryptionKey) {
promptSignagure()
}
}
</script>

Expand Down

0 comments on commit 3415a01

Please sign in to comment.