79441100

Date: 2025-02-15 07:05:19
Score: 1.5
Natty:
Report link

Just use axios-cache-interceptor. Everything else is done for you.

import axios, {AxiosInstance} from 'axios';
import { setupCache } from 'axios-cache-interceptor';

const httpClient: AxiosInstance = axios.create({
    withCredentials: true,
})
setupCache(httpClient, {
    ttl: 3000 // cache for 3 seconds
})
Reasons:
  • Probably link only (1):
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Mikhail Ionkin