-
Notifications
You must be signed in to change notification settings - Fork 96
/
index.d.ts
35 lines (29 loc) · 1.19 KB
/
index.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
35
import axios, { AxiosInstance, AxiosError, AxiosResponse } from 'axios';
type Options = Partial<{
errorSuffix: string;
successSuffix: string;
onSuccess({action, next, response}?: any, options?: any): any;
onError({action, next, response}?: any, options?: any): any;
onComplete(): any;
returnRejectedPromiseOnError: boolean;
isAxiosRequest: boolean;
getRequestConfig: AxiosResponse;
getClientName: AxiosInstance;
defaultClientName: string;
getRequestOptions: any;
interceptors: { request?: any[], response?: any[] };
}>;
export type AxiosMiddleware = {
default: (client: AxiosInstance, customMiddleWareOptions?: Options, customClientOptions?: any) => any;
getActionTypes: (action: any) => any;
multiClientMiddleware: (client: any, customMiddleWareOptions?: Options) => any;
(client: AxiosInstance, customMiddleWareOptions?: Options, customClientOptions?: any): any;
}
type Client = { client: AxiosInstance, options?: Options };
export type ClientsList = {
[name: string]: Client;
default: Client;
}
export function multiClientMiddleware(clients?: ClientsList, customMiddlewareOptions?: Options): any;
declare const axiosMiddleware: AxiosMiddleware;
export default AxiosMiddleware;