Blame view

types/axios.d.ts 1.51 KB
1
export type ErrorMessageMode = 'none' | 'modal' | 'message' | undefined;
2
export type SuccessMessageMode = ErrorMessageMode;
3
陈文彬 authored
4
export interface RequestOptions {
Vben authored
5
  // Splicing request parameters to url
陈文彬 authored
6
  joinParamsToUrl?: boolean;
Vben authored
7
  // Format request parameter time
陈文彬 authored
8
  formatDate?: boolean;
Vben authored
9
  // Whether to process the request result
10
  isTransformResponse?: boolean;
Vben authored
11
12
  // Whether to return native response headers
  // For example: use this attribute when you need to get the response headers
13
  isReturnNativeResponse?: boolean;
Vben authored
14
  // Whether to join url
陈文彬 authored
15
  joinPrefix?: boolean;
Vben authored
16
  // Interface address, use the default apiUrl if you leave it blank
陈文彬 authored
17
  apiUrl?: string;
18
19
  // 请求拼接路径
  urlPrefix?: string;
Vben authored
20
  // Error message prompt type
21
  errorMessageMode?: ErrorMessageMode;
22
23
  // Success message prompt type
  successMessageMode?: SuccessMessageMode;
Vben authored
24
  // Whether to add a timestamp
vben authored
25
  joinTime?: boolean;
Vben authored
26
  ignoreCancelToken?: boolean;
27
28
  // Whether to send token in header
  withToken?: boolean;
29
30
  // 请求重试机制
  retryRequest?: RetryRequest;
陈文彬 authored
31
32
}
33
34
35
36
37
export interface RetryRequest {
  isOpenRetry: boolean;
  count: number;
  waitTime: number;
}
陈文彬 authored
38
export interface Result<T = any> {
sanmu authored
39
  result: number;
陈文彬 authored
40
41
  type: 'success' | 'error' | 'warning';
  message: string;
sanmu authored
42
  data: T;
陈文彬 authored
43
}
Vben authored
44
45

// multipart/form-data: upload file
jq authored
46
export interface UploadFileParams {
Vben authored
47
  // Other parameters
Vben authored
48
  data?: Recordable;
Vben authored
49
  // File parameter interface field name
jq authored
50
  name?: string;
Vben authored
51
  // file name
jq authored
52
  file: File | Blob;
Vben authored
53
  // file name
jq authored
54
  filename?: string;
55
  [key: string]: any;
jq authored
56
}