Skip to content

Latest commit

 

History

History
37 lines (25 loc) · 590 Bytes

README.md

File metadata and controls

37 lines (25 loc) · 590 Bytes

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