32 lines
800 B
JavaScript
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}; |