Sto costruendo un'applicazione in risposta nativa che effettua chiamate di recupero che si basano sulle informazioni più aggiornate dal server. Ho notato che sembra memorizzare nella cache la risposta e se eseguo quella chiamata di recupero di nuovo restituisce la risposta memorizzata nella cache piuttosto che le nuove informazioni dal mio server.React Native - Recupera chiamata cache
La mia funzione è la seguente:
goToAll() {
AsyncStorage.getItem('FBId')
.then((value) => {
api.loadCurrentUser(value)
.then((res) => {
api.loadContent(res['RegisteredUser']['id'])
.then((res2) => {
console.log(res2);
this.props.navigator.push({
component: ContentList,
title: 'All',
passProps: {
content: res2,
user: res['RegisteredUser']['id']
}
})
});
});
})
.catch((error) => {console.log(error);})
.done();
}
e la funzione da api.js im chiamata è la seguente:
loadContent(userid){
let url = `http://####.com/api/loadContent?User_id=${userid}`;
return fetch(url).then((response) => response.json());
}