Blame view

types/axios.d.ts 1.1 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;
10
11
  // 是否返回原生响应头 比如:需要获取响应头时使用该属性
  isReturnNativeResponse?: boolean;
Vben authored
12
  // Whether to join url
陈文彬 authored
13
  joinPrefix?: boolean;
Vben authored
14
  // Interface address, use the default apiUrl if you leave it blank
陈文彬 authored
15
  apiUrl?: string;
Vben authored
16
  // Error message prompt type
17
  errorMessageMode?: ErrorMessageMode;
Vben authored
18
  // Whether to add a timestamp
vben authored
19
  joinTime?: boolean;
Vben authored
20
  ignoreCancelToken?: boolean;
陈文彬 authored
21
22
23
24
25
26
27
28
}

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

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