29 lines
475 B
TypeScript
29 lines
475 B
TypeScript
import { defineStore } from 'pinia'
|
|
|
|
|
|
const useAuthStore = defineStore('appauth', {
|
|
state: () => {
|
|
return {
|
|
isLogin: false,
|
|
_userInfo: null,
|
|
}
|
|
},
|
|
|
|
persist: true,
|
|
|
|
getters: {
|
|
userInfo(): IUser | null {
|
|
return this._userInfo
|
|
}
|
|
},
|
|
|
|
actions: {
|
|
login(data: any) {
|
|
this.isLogin = true
|
|
this._userInfo = data
|
|
},
|
|
},
|
|
})
|
|
|
|
|
|
export default useAuthStore |