2022-09-20 19:59:52 +00:00
|
|
|
<template>
|
2022-11-08 16:44:04 +00:00
|
|
|
<div>
|
|
|
|
<h3 class="font-semibold text-2xl text-gray-900">Danger zone</h3>
|
|
|
|
<p class="text-gray-600 text-sm mt-2">
|
|
|
|
This will permanently delete your entire account. All your forms, submissions and workspaces will be deleted.
|
|
|
|
<span class="text-red-500">
|
|
|
|
This cannot be undone.
|
|
|
|
</span>
|
2022-09-20 19:59:52 +00:00
|
|
|
</p>
|
|
|
|
|
|
|
|
<!-- Submit Button -->
|
|
|
|
<v-button :loading="loading" class="mt-4" color="red" @click="alertConfirm('Do you really want to delete your account?',deleteAccount)">
|
2022-11-08 16:44:04 +00:00
|
|
|
Delete account
|
2022-09-20 19:59:52 +00:00
|
|
|
</v-button>
|
2022-11-08 16:44:04 +00:00
|
|
|
</div>
|
2022-09-20 19:59:52 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import Form from 'vform'
|
|
|
|
import axios from 'axios'
|
2022-12-22 10:55:17 +00:00
|
|
|
import SeoMeta from '../../mixins/seo-meta'
|
2022-09-20 19:59:52 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
scrollToTop: false,
|
2022-12-22 10:55:17 +00:00
|
|
|
mixins: [SeoMeta],
|
2022-09-20 19:59:52 +00:00
|
|
|
|
|
|
|
data: () => ({
|
2022-12-22 10:55:17 +00:00
|
|
|
metaTitle: 'Account',
|
2022-09-20 19:59:52 +00:00
|
|
|
form: new Form({
|
|
|
|
identifier: ''
|
|
|
|
}),
|
|
|
|
loading: false
|
|
|
|
}),
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
async deleteAccount () {
|
|
|
|
this.loading = true
|
|
|
|
axios.delete('/api/user').then(async (response) => {
|
|
|
|
this.loading = false
|
|
|
|
this.alertSuccess(response.data.message)
|
|
|
|
// Log out the user.
|
|
|
|
await this.$store.dispatch('auth/logout')
|
|
|
|
|
|
|
|
// Redirect to login.
|
|
|
|
this.$router.push({ name: 'login' })
|
|
|
|
}).catch((error) => {
|
|
|
|
this.alertError(error.response.data.message)
|
|
|
|
this.loading = false
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|