1 parent
f137d59c72
commit
b1926807f2
5 files changed
+206
-43
No files matched your search
@@ -1,14 +1,29 @@
|
||||
import {defineStore} from "pinia";
|
||||
import {http} from "@/utils/axios";
|
||||
|
||||
const useGlobalStatusStore = defineStore('useGlobalStatusStore', {
|
||||
state() {
|
||||
return {
|
||||
isLogin: true,
|
||||
userInfos:{}
|
||||
userInfos: {}
|
||||
}
|
||||
},
|
||||
getters: {},
|
||||
actions: {}
|
||||
getters: {
|
||||
isLogin(state) {
|
||||
return Object.keys(state.userInfos) !== 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()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user