Fix static destructuring from reactive source in MyAccount and ModalAccountInfo

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-09 13:51:23 +08:00
parent 8f610f1244
commit 3db725e52c
2 changed files with 10 additions and 5 deletions

View File

@@ -56,7 +56,10 @@ import Badge from "../../components/StatusBadge.vue";
const acctMgmtStore = useAcctMgmtStore(); const acctMgmtStore = useAcctMgmtStore();
const visitTime = ref(0); const visitTime = ref(0);
const currentViewingUser = computed(() => acctMgmtStore.currentViewingUser); const currentViewingUser = computed(() => acctMgmtStore.currentViewingUser);
const { username, name, is_admin, is_active } = currentViewingUser.value; const username = computed(() => currentViewingUser.value.username);
const name = computed(() => currentViewingUser.value.name);
const is_admin = computed(() => currentViewingUser.value.is_admin);
const is_active = computed(() => currentViewingUser.value.is_active);
onBeforeMount(async () => { onBeforeMount(async () => {
await acctMgmtStore.getUserDetail(currentViewingUser.value.username); await acctMgmtStore.getUserDetail(currentViewingUser.value.username);

View File

@@ -214,7 +214,9 @@ const toast = useToast();
const visitTime = ref(0); const visitTime = ref(0);
const currentViewingUser = computed(() => acctMgmtStore.currentViewingUser); const currentViewingUser = computed(() => acctMgmtStore.currentViewingUser);
const name = computed(() => currentViewingUser.value.name); const name = computed(() => currentViewingUser.value.name);
const { username, is_admin, is_active } = currentViewingUser.value; const username = computed(() => currentViewingUser.value.username);
const is_admin = computed(() => currentViewingUser.value.is_admin);
const is_active = computed(() => currentViewingUser.value.is_active);
const inputName = ref(name.value); const inputName = ref(name.value);
const inputPwd = ref(""); const inputPwd = ref("");
@@ -241,9 +243,9 @@ const validatePwdLength = () => {
/** Saves the edited name to the server and refreshes user data. */ /** Saves the edited name to the server and refreshes user data. */
const onSaveNameClick = async () => { const onSaveNameClick = async () => {
if (inputName.value.length > 0) { if (inputName.value.length > 0) {
await acctMgmtStore.editAccountName(username, inputName.value); await acctMgmtStore.editAccountName(username.value, inputName.value);
await toast.success(i18next.t("AcctMgmt.MsgAccountEdited")); await toast.success(i18next.t("AcctMgmt.MsgAccountEdited"));
await acctMgmtStore.getUserDetail(username); await acctMgmtStore.getUserDetail(username.value);
isNameEditable.value = false; isNameEditable.value = false;
inputName.value = name.value; inputName.value = name.value;
} }
@@ -254,7 +256,7 @@ const onSavePwdClick = async () => {
validatePwdLength(); validatePwdLength();
if (isPwdLengthValid.value) { if (isPwdLengthValid.value) {
isPwdEditable.value = false; isPwdEditable.value = false;
await acctMgmtStore.editAccountPwd(username, inputPwd.value); await acctMgmtStore.editAccountPwd(username.value, inputPwd.value);
await toast.success(i18next.t("AcctMgmt.MsgAccountEdited")); await toast.success(i18next.t("AcctMgmt.MsgAccountEdited"));
inputPwd.value = ""; inputPwd.value = "";
await acctMgmtStore.getUserDetail(loginStore.userData.username); await acctMgmtStore.getUserDetail(loginStore.userData.username);