0.1.2 • Published 5 years ago

axios-adapter-offline v0.1.2

Weekly downloads
11
License
MIT
Repository
github
Last release
5 years ago

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

License

MIT License