|
|
@ -4,7 +4,7 @@ import { ref, reactive } from 'vue' |
|
|
|
const userStore = defineStore('userStore', () => { |
|
|
|
const userStore = defineStore('userStore', () => { |
|
|
|
const userInfo = reactive<any>({}) |
|
|
|
const userInfo = reactive<any>({}) |
|
|
|
const isLogin = ref(false) |
|
|
|
const isLogin = ref(false) |
|
|
|
const token = ref(sessionStorage.getItem('TOKEN') || '') |
|
|
|
const token = ref(localStorage.getItem('TOKEN') || '') |
|
|
|
const verifyToken = () => { } |
|
|
|
const verifyToken = () => { } |
|
|
|
const clearUserInfo = () => { |
|
|
|
const clearUserInfo = () => { |
|
|
|
Object.keys(userInfo).forEach(function (prop) { |
|
|
|
Object.keys(userInfo).forEach(function (prop) { |
|
|
@ -13,7 +13,7 @@ const userStore = defineStore('userStore', () => { |
|
|
|
} |
|
|
|
} |
|
|
|
const setToken = (data: string) => { |
|
|
|
const setToken = (data: string) => { |
|
|
|
token.value = data
|
|
|
|
token.value = data
|
|
|
|
sessionStorage.setItem('TOKEN', data) |
|
|
|
localStorage.setItem('TOKEN', data) |
|
|
|
} |
|
|
|
} |
|
|
|
const setUserInfo = async () => { |
|
|
|
const setUserInfo = async () => { |
|
|
|
try { |
|
|
|
try { |
|
|
|