fix26: полный прод-фикс auth/jwt, import-export peer и frontend flow

This commit is contained in:
2026-05-09 01:18:13 +05:00
parent 7a64d76d08
commit c13841b61a
19 changed files with 390 additions and 90 deletions
+9 -2
View File
@@ -24,6 +24,10 @@ router.beforeEach(async (to, from, next) => {
const adminStore = useAdminStoreHook();
const hasRoles = adminStore.roles && adminStore.roles.length > 0;
if (hasRoles) {
if (adminStore.forcePasswordChange && to.path !== "/admin/change-password") {
next({ path: "/admin/change-password", query: { redirect: to.fullPath } });
return;
}
// Если маршрут не найден, перейти на 404
if (to.matched.length === 0) {
from.name ? next({ name: from.name }) : next("/404");
@@ -32,11 +36,15 @@ router.beforeEach(async (to, from, next) => {
}
} else {
try {
const { roles } = await adminStore.getAdminInfo();
const { roles, forcePasswordChange } = await adminStore.getAdminInfo();
const accessRoutes = permissionStore.generateRoutes(roles);
accessRoutes.forEach((route) => {
router.addRoute(route);
});
if (forcePasswordChange && to.path !== "/admin/change-password") {
next({ path: "/admin/change-password", query: { redirect: to.fullPath }, replace: true });
return;
}
next({ ...to, replace: true });
} catch (error) {
// Удалить token и перейти на страницу входа
@@ -61,4 +69,3 @@ router.afterEach(() => {
NProgress.done();
});