Quantcast
Channel: Active questions tagged react-native+android - Stack Overflow
Viewing all articles
Browse latest Browse all 29622

react-native android app doesn't download new data using axios

$
0
0

I am using axios to get a page downloaded and this remote page is only updated once a day. I have noticed that even when running the function that does the axios stuff every minute or so using the setInterval() function, the new data is not loaded in the app.

I am using the following axios setup to pass in the headers to skip caching.

api = axios.create({    baseURL: this.URL,    timeout: 1000,    headers: { 'Cache-Control': 'no-store' }, // makes sure that cache is ignored.  });

and later I am doing the usual api.get() to get the data which seems to work just fine. I have also tested that the setInterval() works as expected as I can see the responses being downloaded in the console.

When I publish the android app and run it for the first time, I see the latest data, however when the site changes, the app keeps displaying the same old data.

On my phone, when I clear all the cache/data for the app, it seems to go ahead and get the new data.

I am not sure, if its an axios issue or an android issue as I am sure this is pretty common (looping through and checking for new data.

Thanks :)


Viewing all articles
Browse latest Browse all 29622

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>