刘洋 před 2 roky
rodič
revize
bee2334944
1 změnil soubory, kde provedl 5 přidání a 2 odebrání
  1. 5 2
      src/router/index.ts

+ 5 - 2
src/router/index.ts

@@ -36,7 +36,11 @@ const router = createRouter({
 
 
 router.beforeEach(async (to, from, next) => {
 router.beforeEach(async (to, from, next) => {
   const mainStore = useMainStore()
   const mainStore = useMainStore()
-  if (!mainStore.myUserInfo && sessionStorage.get('LOGIN_RESULT') && to.name !== 'Login') {
+  if (
+    !mainStore.myUserInfo &&
+    sessionStorage.get('LOGIN_RESULT') &&
+    !['Login', 'CheckExam', 'InitCreateExam', 'InitUserName'].includes(String(to.name))
+  ) {
     await mainStore.getMyUserInfo()
     await mainStore.getMyUserInfo()
   }
   }
   if (
   if (
@@ -47,7 +51,6 @@ router.beforeEach(async (to, from, next) => {
     mainStore.myUserInfo?.passwordWeak
     mainStore.myUserInfo?.passwordWeak
   ) {
   ) {
     console.log('to:', to)
     console.log('to:', to)
-
     next({ name: 'ChangePassword', query: { redirectPath: encodeURIComponent(to.fullPath) } })
     next({ name: 'ChangePassword', query: { redirectPath: encodeURIComponent(to.fullPath) } })
   } else if (to.meta?.auth === false || to.name === 'Login' || sessionStorage.get('LOGIN_RESULT')) {
   } else if (to.meta?.auth === false || to.name === 'Login' || sessionStorage.get('LOGIN_RESULT')) {
     next()
     next()