mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
fix(projects): 修复未登录时会调用获取用户路由的接口
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import type { Router } from 'vue-router';
|
||||
import { defineStore } from 'pinia';
|
||||
import { fetchUserRoutes } from '@/service';
|
||||
import { transformAuthRouteToMenu, transformAuthRoutesToVueRoutes, getCacheRoutes } from '@/utils';
|
||||
import { getUserInfo, transformAuthRouteToMenu, transformAuthRoutesToVueRoutes, getCacheRoutes } from '@/utils';
|
||||
import type { GlobalMenuOption } from '@/interface';
|
||||
import { useTabStore } from '../tab';
|
||||
|
||||
@ -31,7 +31,9 @@ export const useRouteStore = defineStore('route-store', {
|
||||
async initDynamicRoute(router: Router) {
|
||||
const { initHomeTab } = useTabStore();
|
||||
|
||||
const { data } = await fetchUserRoutes();
|
||||
const { userId } = getUserInfo();
|
||||
if (!userId) return;
|
||||
const { data } = await fetchUserRoutes(userId);
|
||||
if (data) {
|
||||
this.routeHomeName = data.home;
|
||||
this.menus = transformAuthRouteToMenu(data.routes);
|
||||
|
Reference in New Issue
Block a user