mirror of
https://github.com/arthurfiorette/axios-cache-interceptor.git
synced 2025-12-08 17:36:16 +00:00
* feat: added issue template * fix: move dev bundles to a specific folder * docs: some documentation changes * docs: updated issue template * chore!: updated build setup * style: formatted code * chore: allow importing any file
784 B
784 B
Development
TL;DR: import { setupCache } from 'axios-cache-interceptor/dev';
All debugging information is emitted into a different bundle, this way it's possible to prevent unnecessary code from being bundled into the production build.
Checkout how it helps debugging:
const Axios = require('axios');
const { setupCache } = require('axios-cache-interceptor/dev');
const axios = setupCache(Axios, {
// Print all debug information to the console
debug: console.log
});
const req1 = axios.get('https://jsonplaceholder.typicode.com/posts/1');
const req2 = axios.get('https://jsonplaceholder.typicode.com/posts/1');
const [res1, res2] = await Promise.all([req1, req2]);
console.log('Request 1:', res1.cached);
console.log('Request 2:', res2.cached);