mirror of
https://github.com/arthurfiorette/axios-cache-interceptor.git
synced 2025-12-08 17:36:16 +00:00
docs: updated readme
This commit is contained in:
parent
c48769a9c9
commit
d8afd8a9e9
@ -1,3 +1,4 @@
|
||||
/node_modules
|
||||
/dist
|
||||
/ignore
|
||||
/ignore
|
||||
/docs
|
||||
17
README.md
17
README.md
@ -36,6 +36,13 @@ Axios Cache Interceptor</h1>
|
||||
target="_blank"
|
||||
alt="License" /></a
|
||||
></code>
|
||||
<code
|
||||
><a href="https://codecov.io/gh/arthurfiorette/axios-cache-adapter"
|
||||
><img
|
||||
src="https://codecov.io/gh/arthurfiorette/axios-cache-adapter/branch/main/graph/badge.svg"
|
||||
target="_blank"
|
||||
alt="Codecov" /></a
|
||||
></code>
|
||||
<code
|
||||
><a href="https://www.npmjs.com/package/axios-cache-interceptor"
|
||||
><img
|
||||
@ -75,14 +82,8 @@ const cachedApi = createCache(api, {
|
||||
interpretHeader: true
|
||||
});
|
||||
|
||||
// Make a requests that's only cached if the response comes with success header
|
||||
cachedApi.get('http://example.com/', {
|
||||
cache: {
|
||||
cachePredicate: {
|
||||
containsHeaders: ['success']
|
||||
}
|
||||
}
|
||||
});
|
||||
// Make a simple request, with caching support, to the api
|
||||
const { data } = await cachedApi.get('https://api.example.com/');
|
||||
```
|
||||
|
||||
<br />
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
// @ts-nocheck
|
||||
// Readme example
|
||||
|
||||
import axios from 'axios';
|
||||
@ -15,11 +16,5 @@ const cachedApi = createCache(api, {
|
||||
interpretHeader: true
|
||||
});
|
||||
|
||||
// Make a requests that's only cached if the response comes with success header
|
||||
cachedApi.get('http://example.com/', {
|
||||
cache: {
|
||||
cachePredicate: {
|
||||
containsHeaders: ['success']
|
||||
}
|
||||
}
|
||||
});
|
||||
// Make a simple request, with caching support, to the api
|
||||
const { data } = await cachedApi.get('https://api.example.com/');
|
||||
Loading…
x
Reference in New Issue
Block a user