mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-27 01:32:03 +08:00
55 lines
1.4 KiB
TypeScript
55 lines
1.4 KiB
TypeScript
export type ErrorMessageMode = 'none' | 'modal' | 'message' | undefined
|
|
|
|
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
|
|
// Whether to join url
|
|
joinPrefix?: boolean
|
|
// Interface address, use the default apiUrl if you leave it blank
|
|
apiUrl?: string
|
|
// 请求拼接路径
|
|
urlPrefix?: string
|
|
// Error message prompt type
|
|
errorMessageMode?: ErrorMessageMode
|
|
// Whether to add a timestamp
|
|
joinTime?: boolean
|
|
ignoreCancelToken?: boolean
|
|
// Whether to send token in header
|
|
withToken?: boolean
|
|
// 请求重试机制
|
|
retryRequest?: RetryRequest
|
|
}
|
|
|
|
export interface RetryRequest {
|
|
isOpenRetry: boolean
|
|
count: number
|
|
waitTime: number
|
|
}
|
|
export interface RequestResult<T = any> {
|
|
code: number
|
|
type: 'success' | 'error' | 'warning'
|
|
msg: string
|
|
result: T
|
|
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
|
|
}
|