tangning 8 달 전
부모
커밋
23b0f8b0a8
1개의 변경된 파일3개의 추가작업 그리고 4개의 파일을 삭제
  1. 3 4
      src/request/index.ts

+ 3 - 4
src/request/index.ts

@@ -46,10 +46,10 @@ axios.interceptors.request.use(async (config) => {
 
   const { token, userId } = getAuth();
   let caseId = router.currentRoute.value?.params?.caseId
-  console.log("token",getAuth, token, "userId", userId, config.url);
+  console.log("token",localStorage.getItem('token'), token, "userId", userId, config.url);
   if (!token && !~notLoginUrls.indexOf(config.url)) {
     // router.replace({ name: RouteName.login });
-    let redirect = encodeURIComponent(`${window.location.origin}/mix3d/#/home/${caseId}`);
+    let redirect = encodeURIComponent(`${window.location.href}`);
     window.location.href = window.location.origin + "/admin/#/login?redirect=" + redirect;
     throw "用户未登录";
   }
@@ -96,8 +96,7 @@ const responseInterceptor = (res: AxiosResponse<any, any>) => {
       ~unAuthCode.indexOf(res.data.code) ||
       errMsg === "token已经失效,请重新登录"
     ) {
-      let caseId = router.currentRoute.value?.params?.caseId
-      let redirect = encodeURIComponent(`${window.location.origin}/mix3d/#/home/${caseId}`);
+      let redirect = encodeURIComponent(`${window.location.href}`);
       window.location.href = window.location.origin + "/admin/#/login?redirect=" + redirect;
       // router.replace({ name: RouteName.login });
       getAuth().clear();