mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-16 11:02:11 +08:00
Add axios config defaults definitions
This commit is contained in:
@@ -91,3 +91,9 @@ var repoSum = (repo1: Axios.AxiosXHR<Repository>, repo2: Axios.AxiosXHR<Reposito
|
||||
};
|
||||
|
||||
axios.all<Repository, Repository>([getRepoDetails, getRepoDetails]).then(axios.spread(repoSum));
|
||||
|
||||
axios.defaults.baseURL = 'https://api.example.com';
|
||||
axios.defaults.headers.common['Authorization'] = "AUTH_TOKEN";
|
||||
axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
|
||||
|
||||
axiosInstance.defaults.headers.common['Authorization'] = "AUTH_TOKEN";
|
||||
17
axios/axios.d.ts
vendored
17
axios/axios.d.ts
vendored
@@ -124,6 +124,18 @@ declare namespace Axios {
|
||||
data?: T;
|
||||
}
|
||||
|
||||
interface AxiosXHRConfigDefaults<T> extends AxiosXHRConfigBase<T> {
|
||||
/**
|
||||
* custom headers to be sent
|
||||
*/
|
||||
headers: {
|
||||
common: {[index: string]: string};
|
||||
patch: {[index: string]: string};
|
||||
post: {[index: string]: string};
|
||||
put: {[index: string]: string};
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* <T> - expected response type,
|
||||
* <U> - request body data type
|
||||
@@ -223,6 +235,11 @@ declare namespace Axios {
|
||||
*/
|
||||
interceptors: Interceptor;
|
||||
|
||||
/**
|
||||
* Config defaults
|
||||
*/
|
||||
defaults: AxiosXHRConfigDefaults<any>;
|
||||
|
||||
/**
|
||||
* equivalent to `Promise.all`
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user