mirror of
https://github.com/arthurfiorette/axios-cache-interceptor.git
synced 2025-12-08 17:36:16 +00:00
2.8 KiB
2.8 KiB
Installing
With Npm
# Npm
npm install --save axios axios-cache-interceptor
# Yarn
yarn add axios axios-cache-interceptor
// CommonJS
const { setupCache } = require('axios-cache-interceptor');
import { setupCache } from 'axios-cache-interceptor';
// ES Modules
import { setupCache } from 'axios-cache-interceptor/esm';
// Universal
const { setupCache } = require('axios-cache-interceptor/umd');
With CDN
const { setupCache } = window.AxiosCacheInterceptor;
<!-- Production for ES6+ (~9.5KB) -->
<script
src="https://cdn.jsdelivr.net/npm/axios-cache-interceptor@0.8.3/umd/es6.js"
integrity="sha256-nKoAFeqfjqk/zGKrsCJbFcFAn86H12uVGosvfKzrPQA="
crossorigin="anonymous"
></script>
<!-- Production for ES5+ (~12.8KB) (Needs Promise polyfill) -->
<script
src="https://cdn.jsdelivr.net/npm/axios-cache-interceptor@0.8.3/umd/es5.js"
integrity="sha256-K4+/MYdTXXV7Z9Y2O9CKUNIFOWOo0pjA/22UKUvq1hE="
crossorigin="anonymous"
></script>
With URL imports
You can import any CDN Url and use it in your code. UMD Compatible
// ESM with Skypack CDN
import { setupCache } from 'https://cdn.skypack.dev/axios-cache-interceptor@0.8.3';
// UMD with JSDeliver CDN
import { setupCache } from 'https://cdn.jsdelivr.net/npm/axios-cache-interceptor@0.8.3/umd/index.js';
Support List
Below you can check what version of this package is supported by your version of axios. But that does not mean that won't work with any version. Most of "breaking changes" made by axios was it's types.
Note
: Below v0.3, axios was not configured as a peer dependency
| Version | Axios |
|---|---|
>= v0.5 |
>= v0.24 |
~ v0.4 |
>= v0.23 |
~ v0.3 |
>= v0.22 |
<= v0.2 |
v0.21 |