global.d.ts 887 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. // types/global.d.ts
  2. import {AxiosRequestConfig} from "axios";
  3. declare global {
  4. interface AxiosResponse<T = any> {
  5. data: ApiResponseData<T>;
  6. status: number;
  7. statusText: string;
  8. headers: {
  9. [key: string]: string;
  10. 'content-type'?: string;
  11. };
  12. config: AxiosRequestConfig;
  13. }
  14. interface ApiResponse<T = any> {
  15. data: ApiResponseData<T>;
  16. status: number;
  17. statusText: string;
  18. headers: {
  19. [key: string]: string;
  20. 'content-type'?: string;
  21. };
  22. config: {
  23. method?: string;
  24. url?: string;
  25. params?: Record<string, any>;
  26. headers?: Record<string, any>;
  27. };
  28. }
  29. interface ApiResponseData<T = any> {
  30. code: number;
  31. msg: string;
  32. success: boolean;
  33. data: T;
  34. }
  35. }