Hello everyone, tell me what the problem is. React.Native Level 2 Course 9- Caching Successful Request Data. I make a request for a local backend with data caching. Just like in the tutorial video I use Apisauce. When I send a request with a working Internet and a running backend server, I immediately receive a positive response response.ok true and data. To test the code with data caching, I turn off the backend server, update the application. Next, I need to wait about two minutes to get a negative response from Apisauce response.ok false and only after that the data from the cache is loaded. Why doesn’t the request immediately receive response.ok false and I have to wait two minutes? In the tutorial video, the answer comes right away. I tried to send a similar request to Postman, there, when the server is turned off, a negative response immediately comes.
Same problem here. Have you figured it out?
Hi, I use timeout: 500,
const instance = axios.create({
baseURL: "http://192.168.100.229:8000/api",
timeout: 500,
headers: {
"Content-Type": "multipart/form-data",
"cache-control": "no-cache",
},
})
2 Likes