26 lines
626 B
TypeScript
26 lines
626 B
TypeScript
// api/types.d.ts
|
|
export interface IApiResponse<T = any> {
|
|
/** 有些后端使用 code 字段,有些使用 success 字段 */
|
|
code?: number | string;
|
|
success?: boolean;
|
|
data?: T;
|
|
msg?: string;
|
|
message?: string;
|
|
errMsg?: string;
|
|
[k: string]: any;
|
|
}
|
|
|
|
/**
|
|
* createRequestClient 返回的 request 函数签名
|
|
*/
|
|
export interface IRequestOptions extends UniApp.RequestOptions {
|
|
// 允许扩展额外字段(例如 FILE 上传专用等)
|
|
maxSize?: number;
|
|
files?: Array<{ name: string; uri: string; fileType?: string }>;
|
|
}
|
|
|
|
export interface ICreateClientConfig {
|
|
baseURL: string;
|
|
timeout?: number;
|
|
}
|