-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaxios.d.ts
56 lines (53 loc) · 1.46 KB
/
axios.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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
}
export interface RetryRequest {
isOpenRetry: boolean
count: number
waitTime: number
}
export interface Result<T = any> {
data: T
message: string
resultCode: string
resultDesc: string
timestamp: number
}
export interface ListResult<T = any> {
list: Array<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
}