Skip to content

Commit

Permalink
feat(mellow-vue): add form handler to delete account
Browse files Browse the repository at this point in the history
  • Loading branch information
DominusKelvin committed Sep 17, 2024
1 parent c2e8958 commit 3e2f765
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions templates/mellow-vue/assets/js/pages/user/profile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ function updateProfile() {
}
})
}
function deleteAccount() {
if (
confirm(
'Are you sure you want to delete your account? This action cannot be undone.'
)
) {
deleteAccountForm.delete('/profile')
}
}
</script>

<template>
Expand Down Expand Up @@ -129,11 +139,8 @@ function updateProfile() {
</p>
</header>

<form
@submit.prevent="deleteAccountForm.delete('/profile')"
class="space-y-4"
>
<InputPassword v-model="deleteAccountForm.password" />
<form @submit.prevent="deleteAccount" class="space-y-4">
<InputPassword required v-model="deleteAccountForm.password" />
<div class="flex items-center justify-end">
<InputButton
:processing="deleteAccountForm.processing"
Expand Down

0 comments on commit 3e2f765

Please sign in to comment.