axios.d.ts 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. export interface Result<T = any> {
  33. code: number;
  34. data: T;
  35. msg: string;
  36. success: boolean;
  37. count: string;
  38. }
  39. // multipart/form-data: upload file
  40. export interface UploadFileParams {
  41. // Other parameters
  42. data?: Recordable;
  43. // File parameter interface field name
  44. name?: string;
  45. // file name
  46. file: File | Blob;
  47. // file name
  48. filename?: string;
  49. [key: string]: any;
  50. }