My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more

Cache Axios

Emil Moe's photo
Emil Moe
·Jun 12, 2019

Axios is a Promise based HTTP client: github.com/axios/axios

I would like to implement a cache control for GET requests. So that I don't query the same URL twice during a page load. That would be a cache that works for 10-20 seconds.

I would like to implement it as transparent as possible. Right now I call Axios by window.axios.get(url).then(response => {}) and the best would be to override the .get() method to inject the cache system.