Полная зачистка legacy + закрытие fix24.1/fix24.2 + обновление логотипа
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import router from "@/router";
|
||||
import { useAccountStoreHook } from "@/store/modules/account";
|
||||
import { useAdminStoreHook } from "@/store/modules/admin";
|
||||
import { usePermissionStoreHook } from "@/store/modules/permission";
|
||||
|
||||
import NProgress from "nprogress";
|
||||
@@ -21,8 +21,8 @@ router.beforeEach(async (to, from, next) => {
|
||||
next({ path: "/" });
|
||||
NProgress.done();
|
||||
} else {
|
||||
const AccountStore = useAccountStoreHook();
|
||||
const hasRoles = AccountStore.roles && AccountStore.roles.length > 0;
|
||||
const adminStore = useAdminStoreHook();
|
||||
const hasRoles = adminStore.roles && adminStore.roles.length > 0;
|
||||
if (hasRoles) {
|
||||
// Если маршрут не найден, перейти на 404
|
||||
if (to.matched.length === 0) {
|
||||
@@ -32,7 +32,7 @@ router.beforeEach(async (to, from, next) => {
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
const { roles } = await AccountStore.getAccountInfo();
|
||||
const { roles } = await adminStore.getAdminInfo();
|
||||
const accessRoutes = permissionStore.generateRoutes(roles);
|
||||
accessRoutes.forEach((route) => {
|
||||
router.addRoute(route);
|
||||
@@ -40,7 +40,7 @@ router.beforeEach(async (to, from, next) => {
|
||||
next({ ...to, replace: true });
|
||||
} catch (error) {
|
||||
// Удалить token и перейти на страницу входа
|
||||
await AccountStore.resetToken();
|
||||
await adminStore.resetToken();
|
||||
next(`/login?redirect=${to.path}`);
|
||||
NProgress.done();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user