refactor: 适配系统配置

This commit is contained in:
Bull-BCLS
2023-09-23 19:23:23 +08:00
parent ff14ceb53f
commit f2dcf65f2b
10 changed files with 114 additions and 39 deletions

View File

@@ -1,13 +1,15 @@
import type { Router, LocationQueryRaw } from 'vue-router';
import NProgress from 'nprogress'; // progress bar
import { useLoginStore } from '@/store';
import { useLoginStore, useAppStore } from '@/store';
import { isLogin } from '@/utils/auth';
export default function setupUserLoginInfoGuard(router: Router) {
router.beforeEach(async (to, from, next) => {
NProgress.start();
const loginStore = useLoginStore();
const appStore = useAppStore();
appStore.init();
if (isLogin()) {
if (loginStore.roles[0]) {
next();