mirror of
https://github.com/tenrok/axios.git
synced 2026-06-17 19:21:29 +03:00
Fixing type definitions so AxiosInstance can be invoked
This commit is contained in:
Vendored
+2
-2
@@ -101,6 +101,8 @@ export interface AxiosInterceptorManager<V> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface AxiosInstance {
|
export interface AxiosInstance {
|
||||||
|
(config: AxiosRequestConfig): AxiosPromise;
|
||||||
|
(url: string, config?: AxiosRequestConfig): AxiosPromise;
|
||||||
defaults: AxiosRequestConfig;
|
defaults: AxiosRequestConfig;
|
||||||
interceptors: {
|
interceptors: {
|
||||||
request: AxiosInterceptorManager<AxiosRequestConfig>;
|
request: AxiosInterceptorManager<AxiosRequestConfig>;
|
||||||
@@ -116,8 +118,6 @@ export interface AxiosInstance {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface AxiosStatic extends AxiosInstance {
|
export interface AxiosStatic extends AxiosInstance {
|
||||||
(config: AxiosRequestConfig): AxiosPromise;
|
|
||||||
(url: string, config?: AxiosRequestConfig): AxiosPromise;
|
|
||||||
create(config?: AxiosRequestConfig): AxiosInstance;
|
create(config?: AxiosRequestConfig): AxiosInstance;
|
||||||
Cancel: CancelStatic;
|
Cancel: CancelStatic;
|
||||||
CancelToken: CancelTokenStatic;
|
CancelToken: CancelTokenStatic;
|
||||||
|
|||||||
@@ -141,6 +141,10 @@ axios.patch<User>('/user', { foo: 'bar' })
|
|||||||
const instance1: AxiosInstance = axios.create();
|
const instance1: AxiosInstance = axios.create();
|
||||||
const instance2: AxiosInstance = axios.create(config);
|
const instance2: AxiosInstance = axios.create(config);
|
||||||
|
|
||||||
|
instance1(config)
|
||||||
|
.then(handleResponse)
|
||||||
|
.catch(handleError);
|
||||||
|
|
||||||
instance1.request(config)
|
instance1.request(config)
|
||||||
.then(handleResponse)
|
.then(handleResponse)
|
||||||
.catch(handleError);
|
.catch(handleError);
|
||||||
|
|||||||
Reference in New Issue
Block a user