【更新】修复清除缓存之后,头像没有更新的问题

pull/98/head
xlzy 2023-03-27 23:14:20 +08:00
parent cc8c7b1e07
commit ae73f1bb14
2 changed files with 8 additions and 0 deletions

View File

@ -27,6 +27,9 @@ const getCacheConfig = (value) => {
return data
}
/**
* deprecated 请使用 useGlobalStore
*/
export const globalStore = defineStore({
id: 'global',
state: () => ({
@ -95,3 +98,5 @@ export const globalStore = defineStore({
}
}
})
export const useGlobalStore = globalStore

View File

@ -4,11 +4,14 @@ import dictApi from '@/api/dev/dictApi'
import router from '@/router'
import tool from '@/utils/tool'
import { message } from 'ant-design-vue'
import { useGlobalStore } from '@/store'
export const afterLogin = async (loginToken) => {
tool.data.set('TOKEN', loginToken)
// 获取登录的用户信息
const loginUser = await loginApi.getLoginUser()
const globalStore = useGlobalStore()
globalStore.setUserInfo(loginUser)
tool.data.set('USER_INFO', loginUser)
// 获取用户的菜单