axios.d.ts 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. // Error message prompt type
  17. errorMessageMode?: ErrorMessageMode;
  18. // Whether to add a timestamp
  19. joinTime?: boolean;
  20. ignoreCancelToken?: boolean;
  21. // Whether to send token in header
  22. withToken?: boolean;
  23. }
  24. export interface Result<T = any> {
  25. code: number;
  26. type: 'success' | 'error' | 'warning';
  27. message: string;
  28. result: T;
  29. }
  30. // multipart/form-data: upload file
  31. export interface UploadFileParams {
  32. // Other parameters
  33. data?: Recordable;
  34. // File parameter interface field name
  35. name?: string;
  36. // file name
  37. file: File | Blob;
  38. // file name
  39. filename?: string;
  40. [key: string]: any;
  41. }
  42. export interface PaginationResult<T = Recordable> {
  43. items: T[];
  44. total: number;
  45. }