perf: 修复router为null
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import { useRouter } from 'vue-router';
|
||||
import router from '@/router';
|
||||
import { defineStore } from 'pinia';
|
||||
import { fetchProfileInfo } from '@/api/all/login';
|
||||
import { useSidebarStore } from '@/stores/modules/side-bar';
|
||||
@ -78,10 +78,8 @@ export const useUserStore = defineStore('user', {
|
||||
},
|
||||
getUserAllowAccessRoutes() {
|
||||
const sidebarStore = useSidebarStore();
|
||||
const router = useRouter();
|
||||
|
||||
const menuList = sidebarStore.menuList;
|
||||
const appRoutes = router.options.routes;
|
||||
const appRoutes = router.options?.routes ?? [];
|
||||
|
||||
appRoutes.forEach((route: any) => {
|
||||
if (!route.meta?.requiresAuth) {
|
||||
|
||||
Reference in New Issue
Block a user