2023-05-24 11:08:08 +08:00
|
|
|
|
export type ErrorMessageMode = 'none' | 'modal' | 'message' | undefined;
|
|
|
|
|
|
|
|
|
|
export interface RequestOptions {
|
|
|
|
|
// 是否需要处理请求结果
|
|
|
|
|
isTransformResponse?: boolean;
|
|
|
|
|
// 是否需要返回原生响应头
|
|
|
|
|
isReturnNativeResponse?: boolean;
|
|
|
|
|
handleError?: boolean;
|
|
|
|
|
// post请求时,是否使用URLSearchParams
|
|
|
|
|
joinParamsToUrl?: boolean;
|
|
|
|
|
// Error message prompt type
|
|
|
|
|
errorMessageMode?: ErrorMessageMode;
|
|
|
|
|
// Whether to add a timestamp
|
|
|
|
|
joinTime?: boolean;
|
|
|
|
|
ignoreCancelToken?: boolean;
|
|
|
|
|
// Whether to send token in header
|
|
|
|
|
withToken?: boolean;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface Result<T = any> {
|
2023-06-02 15:18:59 +08:00
|
|
|
|
code: number;
|
2023-05-24 11:08:08 +08:00
|
|
|
|
type: 'success' | 'error' | 'warning';
|
|
|
|
|
message: string;
|
2023-06-02 15:18:59 +08:00
|
|
|
|
messageDetail?: string;
|
|
|
|
|
data: T;
|
2023-05-24 11:08:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// multipart/form-data: upload file
|
|
|
|
|
export interface UploadFileParams {
|
|
|
|
|
// Other parameters
|
|
|
|
|
data?: Recordable;
|
|
|
|
|
// File parameter interface field name
|
|
|
|
|
name?: string;
|
|
|
|
|
// file name
|
|
|
|
|
file: File | Blob;
|
|
|
|
|
// file name
|
|
|
|
|
filename?: string;
|
|
|
|
|
[key: string]: any;
|
|
|
|
|
}
|