feat: 完成对接接口
This commit is contained in:
@@ -11,6 +11,7 @@ interface BaseResponse<T = any> {
|
||||
data: T;
|
||||
msg: string;
|
||||
}
|
||||
|
||||
// 扩展请求函数类型声明
|
||||
declare module 'hook-fetch' {
|
||||
interface HookFetchDefaults {
|
||||
@@ -19,8 +20,7 @@ declare module 'hook-fetch' {
|
||||
}
|
||||
}
|
||||
export const request = hookFetch.create<BaseResponse>({
|
||||
// baseURL: import.meta.env.VITE_API_URL,
|
||||
baseURL: '', // 留空或使用'/'
|
||||
baseURL: import.meta.env.VITE_WEB_BASE_API,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
@@ -33,7 +33,6 @@ export const request = hookFetch.create<BaseResponse>({
|
||||
if (typeof response.result?.code === 'number') {
|
||||
return response;
|
||||
}
|
||||
|
||||
// 非标准格式 → 包装为标准格式
|
||||
return {
|
||||
...response,
|
||||
|
||||
Reference in New Issue
Block a user