Blame view

types/axios.d.ts 1.24 KB
1
2
export type ErrorMessageMode = 'none' | 'modal' | 'message' | undefined;
陈文彬 authored
3
export interface RequestOptions {
Vben authored
4
  // Splicing request parameters to url
陈文彬 authored
5
  joinParamsToUrl?: boolean;
Vben authored
6
  // Format request parameter time
陈文彬 authored
7
  formatDate?: boolean;
Vben authored
8
  // Whether to process the request result
9
  isTransformResponse?: boolean;
Vben authored
10
11
  // Whether to return native response headers
  // For example: use this attribute when you need to get the response headers
12
  isReturnNativeResponse?: boolean;
Vben authored
13
  // Whether to join url
陈文彬 authored
14
  joinPrefix?: boolean;
Vben authored
15
  // Interface address, use the default apiUrl if you leave it blank
陈文彬 authored
16
  apiUrl?: string;
17
18
  // 请求拼接路径
  urlPrefix?: string;
Vben authored
19
  // Error message prompt type
20
  errorMessageMode?: ErrorMessageMode;
Vben authored
21
  // Whether to add a timestamp
vben authored
22
  joinTime?: boolean;
Vben authored
23
  ignoreCancelToken?: boolean;
24
25
  // Whether to send token in header
  withToken?: boolean;
陈文彬 authored
26
27
28
29
30
31
32
33
}

export interface Result<T = any> {
  code: number;
  type: 'success' | 'error' | 'warning';
  message: string;
  result: T;
}
Vben authored
34
35

// multipart/form-data: upload file
jq authored
36
export interface UploadFileParams {
Vben authored
37
  // Other parameters
Vben authored
38
  data?: Recordable;
Vben authored
39
  // File parameter interface field name
jq authored
40
  name?: string;
Vben authored
41
  // file name
jq authored
42
  file: File | Blob;
Vben authored
43
  // file name
jq authored
44
  filename?: string;
45
  [key: string]: any;
jq authored
46
}