edit account and logout feature
This commit is contained in:
@@ -142,7 +142,7 @@ import { useToast } from 'vue-toast-notification';
|
||||
import useAcctMgmtStore from '@/stores/acctMgmt.js';
|
||||
import ModalHeader from "./ModalHeader.vue";
|
||||
import IconChecked from "@/components/icons/IconChecked.vue";
|
||||
import { MODAL_CREATE_NEW, } from '@/constants/constants.js';
|
||||
import { MODAL_CREATE_NEW, MODAL_ACCT_EDIT, } from '@/constants/constants.js';
|
||||
|
||||
export default defineComponent({
|
||||
setup() {
|
||||
@@ -226,13 +226,14 @@ export default defineComponent({
|
||||
if(!isPwdMatched.value){
|
||||
return;
|
||||
}
|
||||
|
||||
await checkAccountIsUnique();
|
||||
if(!isAccountUnique.value) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch(whichCurrentModal.value) {
|
||||
case MODAL_CREATE_NEW:
|
||||
await checkAccountIsUnique();
|
||||
if(!isAccountUnique.value) {
|
||||
return;
|
||||
}
|
||||
case MODAL_CREATE_NEW:
|
||||
await acctMgmtStore.createNewAccount({
|
||||
username: inputUserAccount.value,
|
||||
password: inputPwd.value,
|
||||
@@ -245,6 +246,17 @@ export default defineComponent({
|
||||
acctMgmtStore.setShouldUpdateList(true);
|
||||
await router.push('/account/account-admin');
|
||||
break;
|
||||
case MODAL_ACCT_EDIT:
|
||||
// 要注意的是舊的username跟新的username可以是不同的
|
||||
await acctMgmtStore.editAccount(
|
||||
currentViewingUser.value.username, {
|
||||
newUsername: inputUserAccount.value,
|
||||
password: inputPwd.value,
|
||||
name: inputName.value,
|
||||
is_active: true,
|
||||
// is_active: isSetActivedChecked.value, //TODO: 待確認需求規格
|
||||
});
|
||||
await toast.success(i18next.t("AcctMgmt.MsgAccountEdited"));
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user