You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.4 KiB
55 lines
1.4 KiB
4 months ago
|
export type ErrorMessageMode = 'none' | 'modal' | 'message' | undefined;
|
||
|
export type SuccessMessageMode = ErrorMessageMode;
|
||
|
|
||
|
export interface RequestOptions {
|
||
|
// Splicing request parameters to url
|
||
|
joinParamsToUrl?: boolean;
|
||
|
// Format request parameter time
|
||
|
formatDate?: boolean;
|
||
|
// Whether to process the request result
|
||
|
isTransformResponse?: boolean;
|
||
|
// Whether to return native response headers
|
||
|
// For example: use this attribute when you need to get the response headers
|
||
|
isReturnNativeResponse?: boolean;
|
||
|
// Interface address, use the default apiUrl if you leave it blank
|
||
|
apiUrl?: string;
|
||
|
// Error message prompt type
|
||
|
errorMessageMode?: ErrorMessageMode;
|
||
|
// Success message prompt type
|
||
|
successMessageMode?: SuccessMessageMode;
|
||
|
// Whether to add a timestamp
|
||
|
joinTime?: boolean;
|
||
|
ignoreCancelToken?: boolean;
|
||
|
// Whether to send token in header
|
||
|
withToken?: boolean;
|
||
|
// 请求重试机制
|
||
|
retryRequest?: RetryRequest;
|
||
|
/** 是否加密请求参数 */
|
||
|
encrypt?: boolean;
|
||
|
}
|
||
|
|
||
|
export interface RetryRequest {
|
||
|
isOpenRetry: boolean;
|
||
|
count: number;
|
||
|
waitTime: number;
|
||
|
}
|
||
|
|
||
|
export interface Result<T = any> {
|
||
|
code: number;
|
||
|
msg: string;
|
||
|
data?: T;
|
||
|
}
|
||
|
|
||
|
// 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;
|
||
|
}
|