优化前端路由状态加载方式
Some checks are pending
Security Checks / security (push) Waiting to run

This commit is contained in:
smail 2026-08-30 23:09:26 +08:00
parent 38d139f82e
commit ebfa85ae1d

View File

@ -8,6 +8,7 @@ import PasswordRecoveryView from "../views/PasswordRecovery/PasswordRecovery.vue
import ResetBlockedView from "../views/ResetBlocked/ResetBlocked.vue";
import LoginVerificationView from "../views/LoginVerification/LoginVerification.vue";
import ForcePasswordChangeView from "../views/ForcePasswordChange/ForcePasswordChange.vue";
import {useGlobalStatusStore} from "@/stores/useGlobalStatusStore";
const router = createRouter({
history: createWebHashHistory(),
@ -71,7 +72,6 @@ const router = createRouter({
});
router.beforeEach(async (to) => {
const {useGlobalStatusStore} = await import("@/stores/useGlobalStatusStore");
const globalStatus = useGlobalStatusStore();
const needsAuthentication = to.meta.requiresAuth || to.name === "force-password-change";
const authenticated = globalStatus.isLogin || (needsAuthentication && await globalStatus.refresh());