arthurfiorette / axios-cache-interceptor

📬 Small and efficient cache interceptor for axios. Etag, Cache-Control, TTL, HTTP headers and more!

Home Page:https://axios-cache-interceptor.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug: TypeError: 0, _axiosCacheInterceptor.setupCache is not a function (it is undefined)

LouisSyfer opened this issue · comments

What happened?

Good morning,

I use this package in a react native web application managed by Expo and it works normally.
But I just installed it in a native application and when the component where I use axios-cache-interceptor is mounted I get the following error: TypeError: 0, _axiosCacheInterceptor.setupCache is not a function (it is undefined)
I can't find anything in the docs on this subject, nor on the Internet.

Thank you for your clarifications

React native version: 0.72.6
expo sdk 49

axios-cache-interceptor version

^1

Node / Browser Version

Node v18.16.0

Axios Version

^1

What storage is being used

Memory Storage

Relevant debugging log output

TypeError: 0, _axiosCacheInterceptor.setupCache is not a function (it is undefined)

I cannot help you without further information or a reproducible example.

Well, the reproducible demonstration is simply the documentation.
I copied and pasted the codes from the documentation:

import Axios from 'axios';
import { setupCache } from 'axios-cache-interceptor';

const axios = setupCache(Axios);
my req:
const url = fetchApi + api/posts/allposts?limit=${offset} const res = await axios.get(url);

On the web it's working well. But not in my native app...

Closed until a proper reproduction repository is linked.