File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change 1
1
import { AxiosRequestConfig , AxiosResponse , AxiosInstance } from 'axios' ;
2
2
3
- export interface IParams {
3
+ export interface IParams < T > {
4
4
axios ?: AxiosInstance ;
5
5
url : string ;
6
6
method ?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'HEAD' | 'OPTIONS' | 'PATCH' ;
@@ -11,24 +11,24 @@ export interface IParams {
11
11
*/
12
12
filter ?: ( ) => boolean ;
13
13
forceDispatchEffect ?: ( ) => boolean ;
14
- customHandler ?: ( error : null | Error , response : null | AxiosResponse ) => void ;
14
+ customHandler ?: ( error : null | Error , response : null | AxiosResponse < T > ) => void ;
15
15
}
16
16
17
- export interface IResponseStatus {
18
- response : null | AxiosResponse ;
17
+ export interface IResponseStatus < T > {
18
+ response : null | AxiosResponse < T > ;
19
19
error : null | Error ;
20
20
loading : boolean ;
21
21
}
22
22
23
- export interface IReturns extends IResponseStatus {
23
+ export interface IReturns < T > extends IResponseStatus < T > {
24
24
/**
25
25
* @deprecated Alias of `reFetch`
26
26
*/
27
27
query : ( ) => number ;
28
28
reFetch : ( ) => number ;
29
29
}
30
30
31
- declare const useAxios : ( params : IParams ) => IReturns ;
31
+ declare const useAxios : < T = any > ( params : IParams < T > ) => IReturns < T > ;
32
32
export default useAxios ;
33
33
34
34
export declare const axios : AxiosInstance ;
You can’t perform that action at this time.
0 commit comments