refactor: 调整 axios 配置

This commit is contained in:
siujamo
2026-01-05 10:10:51 +08:00
parent a00488be5d
commit 0d3b0bd28d
7 changed files with 8 additions and 6 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
import webClient from "@/service/web-client" import webClient from "@/client/web-client"
import { HttpStatus } from "@/constant" import { HttpStatus } from "@/constant"
import type { CaptchaResponse, UserAuthResponse } from "@/types/web/response" import type { CaptchaResponse, UserAuthResponse } from "@/types/web/response"
import type { UsernamePasswordLoginRequest } from "@/types/web/request" import type { UsernamePasswordLoginRequest } from "@/types/web/request"
+1 -1
View File
@@ -1,4 +1,4 @@
import webClient from "@/service/web-client" import webClient from "@/client/web-client"
import type { TreeNode } from "@/types/tree" import type { TreeNode } from "@/types/tree"
import type { Department } from "@/types/entity" import type { Department } from "@/types/entity"
+1 -1
View File
@@ -1,4 +1,4 @@
import webClient from "@/service/web-client" import webClient from "@/client/web-client"
import type { TreeNode } from "@/types/tree" import type { TreeNode } from "@/types/tree"
import type { MenuItem } from "@/types/entity" import type { MenuItem } from "@/types/entity"
+1 -1
View File
@@ -1,4 +1,4 @@
import webClient from "@/service/web-client" import webClient from "@/client/web-client"
import type { QueryPositionRequest } from "@/types/web/request" import type { QueryPositionRequest } from "@/types/web/request"
import type { PageResponse } from "@/types/web/response" import type { PageResponse } from "@/types/web/response"
import type { Position } from "@/types/entity" import type { Position } from "@/types/entity"
+1 -1
View File
@@ -1,5 +1,5 @@
import type { QueryRoleRequest } from "@/types/web/request" import type { QueryRoleRequest } from "@/types/web/request"
import webClient from "@/service/web-client" import webClient from "@/client/web-client"
import type { PageResponse, RoleResponse } from "@/types/web/response" import type { PageResponse, RoleResponse } from "@/types/web/response"
import type { RoleFormValues } from "@/components/role-display-form" import type { RoleFormValues } from "@/components/role-display-form"
+1 -1
View File
@@ -1,4 +1,4 @@
import webClient from "@/service/web-client" import webClient from "@/client/web-client"
import { getCountryCallingCode } from "libphonenumber-js" import { getCountryCallingCode } from "libphonenumber-js"
import { getDefaultCountryCode } from "@/utils/phone-number-utils" import { getDefaultCountryCode } from "@/utils/phone-number-utils"
import type { AddUserRequest, EditUserRequest, QueryUserRequest } from "@/types/web/request" import type { AddUserRequest, EditUserRequest, QueryUserRequest } from "@/types/web/request"
@@ -8,6 +8,8 @@ import type { GeneralErrorResponse } from "@/types/web/response"
const webClient = axios.create({ const webClient = axios.create({
baseURL: import.meta.env.VITE_API_BASE_URL, baseURL: import.meta.env.VITE_API_BASE_URL,
timeout: dayjs.duration({ seconds: 10 }).asMilliseconds(), timeout: dayjs.duration({ seconds: 10 }).asMilliseconds(),
withCredentials: true,
withXSRFToken: true
}) })
webClient.interceptors.request.use( webClient.interceptors.request.use(