wangfumin 2 месяцев назад
Родитель
Сommit
c518594fa3
1 измененных файлов с 4 добавлено и 4 удалено
  1. 4 4
      src/request/index.ts

+ 4 - 4
src/request/index.ts

@@ -102,8 +102,8 @@ axios.interceptors.request.use(async (config) => {
             // 如果已经在登录页且已有 redirect 参数,避免递归叠加
             const isLogin = current?.name === RouteName.login;
             const existing = (current?.query?.redirect as string | undefined);
-            if (isLogin && existing) {
-              return existing;
+            if (isLogin) {
+              return existing || "";
             }
           } catch {}
           const { origin, pathname, search, hash } = window.location;
@@ -176,8 +176,8 @@ const responseInterceptor = (res: AxiosResponse<any, any>) => {
             const current = router.currentRoute?.value;
             const isLogin = current?.name === RouteName.login;
             const existing = (current?.query?.redirect as string | undefined);
-            if (isLogin && existing) {
-              return existing;
+            if (isLogin) {
+              return existing || "";
             }
           } catch {}
           const { origin, pathname, search, hash } = window.location;