axios-adapter-offline
v0.1.2
Published
offline adapter for axios
Downloads
9
Readme
axios-adapter-offline
Cache response each time, responed with cached when request in offline environment.
Repository based from ali322
Install
npm i axios-adapter-offline --save
or
yarn add axios-adapter-offline
Usage
Add adapter in your request code
import axios from 'axios'
import offlineAdapter from 'axios-adapter-offline'
const offline = offlineAdapter({
name: 'axios-offline',
adapter: axios.defaults.adapter
})
const http = axios.create({
adapter: offline
})
http.get('/path/to/api').then(ret => {
// bussiness code
})