0.0.2 • Published 7 years ago

axios-offline-adapter v0.0.2

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

axios-offline-adapter

cache response each time, responed with cached when request in offline environment

Install

npm i axios-offline-adapter --save

Usage

add adapter in your request code

import axios from 'axios'
import offlineAdapter from 'axios-offline-adapter'

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
})

License

MIT License