axios.d.ts 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. export type ErrorMessageMode = 'none' | 'modal' | 'message' | undefined;
  2. export interface RequestOptions {
  3. // Splicing request parameters to url
  4. joinParamsToUrl?: boolean;
  5. // Format request parameter time
  6. formatDate?: boolean;
  7. // Whether to process the request result
  8. isTransformResponse?: boolean;
  9. // Whether to return native response headers
  10. // For example: use this attribute when you need to get the response headers
  11. isReturnNativeResponse?: boolean;
  12. // Whether to join url
  13. joinPrefix?: boolean;
  14. // Interface address, use the default apiUrl if you leave it blank
  15. apiUrl?: string;
  16. // 请求拼接路径
  17. urlPrefix?: string;
  18. // Error message prompt type
  19. errorMessageMode?: ErrorMessageMode;
  20. // Whether to add a timestamp
  21. joinTime?: boolean;
  22. ignoreCancelToken?: boolean;
  23. // Whether to send token in header
  24. withToken?: boolean;
  25. }
  26. export interface Result<T = any> {
  27. code: number;
  28. type: 'success' | 'error' | 'warning';
  29. message: string;
  30. result: T;
  31. }
  32. // multipart/form-data: upload file
  33. export interface UploadFileParams {
  34. // Other parameters
  35. data?: Recordable;
  36. // File parameter interface field name
  37. name?: string;
  38. // file name
  39. file: File | Blob;
  40. // file name
  41. filename?: string;
  42. [key: string]: any;
  43. }