diff --git a/snowy-admin-web/src/store/global.js b/snowy-admin-web/src/store/global.js index c6689ed4..f90940fa 100644 --- a/snowy-admin-web/src/store/global.js +++ b/snowy-admin-web/src/store/global.js @@ -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 diff --git a/snowy-admin-web/src/views/auth/login/util.js b/snowy-admin-web/src/views/auth/login/util.js index 672c4c6b..03a01f5c 100644 --- a/snowy-admin-web/src/views/auth/login/util.js +++ b/snowy-admin-web/src/views/auth/login/util.js @@ -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) // 获取用户的菜单