Files
Smail/fe/src/stores/useGlobalStatusStore.js
T
Jinnrry c347f30c0c feature/v2.9.0 (#332)
1、ui优化
2、Message Id 格式优化,thanks for @Cd1s
2026-04-18 20:20:19 +08:00

32 lines
800 B
JavaScript

import {defineStore} from "pinia";
import {http} from "@/utils/axios";
const useGlobalStatusStore = defineStore('useGlobalStatusStore', {
state() {
return {
userInfos: {},
mobileDrawerVisible: false,
settingsDrawerVisible: false
}
},
getters: {
isLogin(state) {
return Object.keys(state.userInfos).length !== 0
}
},
actions: {
init(callback) {
let that = this
http.post("/api/user/info", {}).then(res => {
if (res.errorNo === 0) {
Object.assign(that.userInfos, res.data)
console.log("userInfos")
callback()
}
})
}
}
})
export {useGlobalStatusStore};