fix: bug
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 4m4s

This commit is contained in:
sexygoat
2026-05-11 15:51:50 +08:00
parent 766497dc31
commit 1990a3ccba
40 changed files with 832 additions and 127 deletions

View File

@@ -6,7 +6,7 @@ import type { RequestOptions, ErrorMessageMode } from '@/types/api'
const axiosInstance = axios.create({
timeout: 15000, // 请求超时时间(毫秒)
baseURL: import.meta.env.MODE === 'development' ? '' : import.meta.env.VITE_API_URL, // API地址开发环境使用代理,生产环境使用完整URL
baseURL: import.meta.env.DEV ? '' : import.meta.env.VITE_API_URL, // 开发服务器使用代理,其他模式使用完整URL
withCredentials: false, // 异步请求携带cookie
transformRequest: [
(data, headers) => {
@@ -272,9 +272,10 @@ async function request<T = any>(config: ExtendedRequestConfig): Promise<T> {
if (axios.isAxiosError(e)) {
// 默认显示错误消息,除非明确设置为 'none'
const errorMode = config.requestOptions?.errorMessageMode || 'message'
const show404Error = config.requestOptions?.show404Error !== undefined
? config.requestOptions.show404Error
: true
const show404Error =
config.requestOptions?.show404Error !== undefined
? config.requestOptions.show404Error
: true
handleErrorMessage(e, errorMode, show404Error)
}
return Promise.reject(e)