WIP: account info modal prototype with a little bit of pinia state mgmt.

This commit is contained in:
Cindy Chang
2024-06-20 12:13:39 +08:00
parent d6a79687da
commit 26441d3979
9 changed files with 183 additions and 47 deletions

View File

@@ -1,8 +1,17 @@
import { defineStore } from "pinia";
import { accountList, } from "@/constants/constants.js";
export default defineStore('acctMgmtStore', {
state: () => ({
isAcctMenuOpen: false,
currentViewingUser: {
id: 12345,
account: "REDACTED-USER1",
fullName: "Alice Zheng",
adminRights: true,
accountActivation: true,
detail: "abcde",
}
}),
getters: {
},
@@ -22,5 +31,13 @@ export default defineStore('acctMgmtStore', {
toggleIsAcctMenuOpen() {
this.isAcctMenuOpen = !this.isAcctMenuOpen;
},
/**
* For convenience, set current viewing data according to unique user ID.
* @param {number} userId
*/
setCurrentViewingUser(userId) {
const userFind = accountList.find(user => user.id === userId);
this.currentViewingUser = userFind ? userFind : {};
},
},
})