Fetch adapter for axios
npm install @vespaiach/axios-fetch-adapter sh
npm install axios
npm install @vespaiach/axios-fetch-adapter
`
There are two ways to use it:
1. Create a new instance of Axios and pass this adapter in configuration
` js
const instance = axios.create({
baseURL: 'https://some-domain.com/api/',
timeout: 1000,
adapter: fetchAdapter
....
});
`
2. Pass this adapter in each of request
` js
axios.request({
url: '/user',
method: 'get',
adapter: fetchAdapter
...
})
`
3. Use with FormData
` js
axios.request({
url: '/user',
method: 'post',
adapter: fetchAdapter
data: new FormData(formId)
...
})
``