axios.d.ts 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. retryRequest?: RetryRequest;
  27. // 原始方法
  28. rawMethod?: Method;
  29. }
  30. export interface RetryRequest {
  31. isOpenRetry: boolean;
  32. count: number;
  33. waitTime: number;
  34. }
  35. export interface Result<T = any> {
  36. code: number;
  37. success: boolean;
  38. msg: string;
  39. data: T;
  40. }
  41. // multipart/form-data: upload file
  42. export interface UploadFileParams {
  43. // Other parameters
  44. data?: Recordable;
  45. // File parameter interface field name
  46. name?: string;
  47. // file name
  48. file: File | Blob | File[];
  49. // file name
  50. filename?: string;
  51. [key: string]: any;
  52. }