Remembering failed requests and repeating when an internet connection is available
npm install axios-offline --save
or
yarn add axios-offline
import Axios from 'axios'
import AxiosOffline from 'axios-offline'
import LocalForage from "localforage"
let AxiosOfflineAdapter = AxiosOffline({
defaultAdapter: Axios.defaults.adapter, //require, basic adapter
storageName: "axios-offline", //optional, default: "axios-stack"
storageDriver: LocalForage.LOCALSTORAGE //optional, default: LocalForage.LOCALSTORAGE
})
let http = Axios.create({
adapter: AxiosOfflineAdapter
})
export default http