fix: 🐛 修复登录和路由重复获取用户信息的问题

This commit is contained in:
Ray.Hao
2025-08-14 18:34:56 +08:00
parent 9b8299e895
commit d9b2f55a5e
5 changed files with 10 additions and 21 deletions

View File

@@ -22,7 +22,7 @@ export const usePermissionStore = defineStore("permission", () => {
*/
async function generateRoutes(): Promise<RouteRecordRaw[]> {
try {
const data = await MenuAPI.getRoutes();
const data = await MenuAPI.getRoutes(); // 获取当前登录人拥有的菜单路由
const dynamicRoutes = parseDynamicRoutes(data);
routes.value = [...constantRoutes, ...dynamicRoutes];

View File

@@ -137,6 +137,7 @@ export const useUserStore = defineStore("user", () => {
return {
userInfo,
rememberMe,
isLoggedIn: () => !!Auth.getAccessToken(),
getUserInfo,
login,
logout,