-
-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathtypes.d.ts
34 lines (29 loc) · 950 Bytes
/
types.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { AxiosRequestConfig, AxiosResponse, AxiosInstance } from 'axios';
export interface IParams<T> {
axios?: AxiosInstance;
url: string;
method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'HEAD' | 'OPTIONS' | 'PATCH';
options?: AxiosRequestConfig;
trigger?: object | string;
/**
* @deprecated Alias of `forceDispatchEffect`
*/
filter?: () => boolean;
forceDispatchEffect?: () => boolean;
customHandler?: (error: null | Error, response: null | AxiosResponse<T>) => void;
}
export interface IResponseStatus<T> {
response: null | AxiosResponse<T>;
error: null | Error;
loading: boolean;
}
export interface IReturns<T> extends IResponseStatus<T> {
/**
* @deprecated Alias of `reFetch`
*/
query: () => number;
reFetch: () => number;
}
declare const useAxios: <T = any>(params: IParams<T>) => IReturns<T>;
export default useAxios;
export declare const axios: AxiosInstance;