Blame view

types/axios.d.ts 1.2 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;
Vben authored
17
  // Error message prompt type
18
  errorMessageMode?: ErrorMessageMode;
Vben authored
19
  // Whether to add a timestamp
vben authored
20
  joinTime?: boolean;
Vben authored
21
  ignoreCancelToken?: boolean;
22
23
  // Whether to send token in header
  withToken?: boolean;
陈文彬 authored
24
25
26
27
28
29
30
31
}

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

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