Преглед на файлове

空路径不添加重定向参数

Alfyn преди 6 дни
родител
ревизия
20a4ba66bf
променени са 1 файла, в които са добавени 5 реда и са изтрити 1 реда
  1. 5 1
      src/permission.js

+ 5 - 1
src/permission.js

@@ -122,7 +122,11 @@ router.beforeEach(async (to, from, next) => {
       if (window.location.href.startsWith('http://localhost')) {
         next({ path: '/user/login' })
       } else {
-        window.location.href = `https://dev.autocde.com/login?redirect=${to.fullPath}`
+        if(to.fullPath !== '/'){
+          window.location.href = `https://dev.autocde.com/login?redirect=${to.fullPath}`
+        }else{
+          window.location.href = `https://dev.autocde.com/login`
+        }
       }
       NProgress.done() // if current page is login will not trigger afterEach hook, so manually handle it
     }