delete account and later on modal closing effect.

This commit is contained in:
Cindy Chang
2024-06-24 10:09:39 +08:00
parent b55cc0a6d6
commit 00d086ff1d
7 changed files with 51 additions and 11 deletions

View File

@@ -18,7 +18,9 @@
{{ i18next.t("No") }}
</button>
<button id="sure_to_delete_acct_btn" class="flex justify-center items-center rounded-full cursor-pointer w-[100px] h-[40px]
border-2 border-[#FF3366] text-[#FF3366]">
border-2 border-[#FF3366] text-[#FF3366]"
@click="onDeleteConfirmBtnClick"
>
{{ i18next.t("Yes") }}
</button>
</footer>
@@ -28,13 +30,25 @@
<script>
import { defineComponent, ref, computed, onBeforeMount, watch, } from 'vue';
import { useModalStore } from '@/stores/modal.js';
import { useRouter } from 'vue-router';
import useAcctMgmtStore from '@/stores/acctMgmt.js';
import i18next from '@/i18n/i18n.js';
import { useToast } from 'vue-toast-notification';
export default defineComponent({
setup() {
const acctMgmtStore = useAcctMgmtStore();
const modalStore = useModalStore();
const toast = useToast();
const router = useRouter();
const onDeleteConfirmBtnClick = async() => {
if(acctMgmtStore.deleteAccount(acctMgmtStore.currentViewingUser.username)){
toast.success(i18next.t("AcctMgmt.MsgAccountDeleteSuccess"));
modalStore.closeModal();
router.push("/account/account-admin");
}
}
const onNoBtnClick = () => {
modalStore.closeModal();
@@ -42,6 +56,7 @@ export default defineComponent({
return {
i18next,
onDeleteConfirmBtnClick,
onNoBtnClick,
};
},