소스 검색

空路径不添加重定向参数

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
     }