delete account and later on modal closing effect.
This commit is contained in:
@@ -219,6 +219,7 @@ export default {
|
||||
};
|
||||
|
||||
const onDeleteBtnClick = (usernameToDelete) => {
|
||||
acctMgmtStore.setCurrentViewingUser(usernameToDelete);
|
||||
modalStore.openModal(MODAL_DELETE);
|
||||
};
|
||||
|
||||
|
||||
@@ -199,13 +199,6 @@ export default defineComponent({
|
||||
}
|
||||
//TODO: 這邊要記得回來加一個判斷帳號是否已經存在的邏輯
|
||||
checkAccountIsUnique();
|
||||
console.log('input content to feed in',
|
||||
inputUserAccount.value,
|
||||
inputPwd.value,
|
||||
inputName.value,
|
||||
isSetAsAdminChecked.value,
|
||||
isSetActivedChecked.value,
|
||||
);
|
||||
await acctMgmtStore.createNewAccount({
|
||||
username: inputUserAccount.value,
|
||||
password: inputPwd.value,
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user