2
0

http.d.ts 1.9 KB

123456789101112131415161718192021222324252627282930
  1. import type { CreateAxiosDefaults, AxiosInstance, AxiosInterceptorOptions, AxiosRequestConfig, InternalAxiosRequestConfig, AxiosResponse } from "axios";
  2. declare class WrappedAxios {
  3. private instance?;
  4. constructor(options?: CreateAxiosDefaults);
  5. beforeRequest<V = any>(onFulfilled?: ((value: InternalAxiosRequestConfig<V>) => InternalAxiosRequestConfig<V> | Promise<InternalAxiosRequestConfig<V>>) | null, onRejected?: ((error: any) => any) | null, options?: AxiosInterceptorOptions): this;
  6. afterResponse<V = any, D = any>(onFulfilled?: ((value: AxiosResponse<V, D>) => AxiosResponse<V, D> | Promise<AxiosResponse<V, D>>) | null, onRejected?: ((error: any) => any) | null, options?: AxiosInterceptorOptions): this;
  7. get axiosInstance(): AxiosInstance;
  8. get<R = any>(url: string, data: Record<string, any>, config?: AxiosRequestConfig): Promise<R>;
  9. post<R = any>(url: string, data: Record<string, any>, config?: AxiosRequestConfig): Promise<R>;
  10. put<R = any>(url: string, data: Record<string, any>, config?: AxiosRequestConfig): Promise<R>;
  11. delete<R = any>(url: string, data: Record<string, any>, config?: AxiosRequestConfig): Promise<R>;
  12. private createCancelObj;
  13. createGetWithCancel<R = any>(url: string, data: Record<string, any>, config?: AxiosRequestConfig): {
  14. abort(): void;
  15. send: () => Promise<R>;
  16. };
  17. createPostWithCancel<R = any>(url: string, data: Record<string, any>, config?: AxiosRequestConfig): {
  18. abort(): void;
  19. send: () => Promise<R>;
  20. };
  21. createPutWithCancel<R = any>(url: string, data: Record<string, any>, config?: AxiosRequestConfig): {
  22. abort(): void;
  23. send: () => Promise<R>;
  24. };
  25. createDeleteWithCancel<R = any>(url: string, data: Record<string, any>, config?: AxiosRequestConfig): {
  26. abort(): void;
  27. send: () => Promise<R>;
  28. };
  29. }
  30. export { WrappedAxios };