forked from tanner/qotnews
chore: Disable story updates and preloading logic
This commit is contained in:
@@ -14,24 +14,24 @@ function Feed({ updateCache }) {
|
||||
.then(
|
||||
(result) => {
|
||||
const updated = !stories || stories[0].id !== result.stories[0].id;
|
||||
console.log('updated:', updated);
|
||||
console.log('New stories available:', updated);
|
||||
|
||||
setStories(result.stories);
|
||||
localStorage.setItem('stories', JSON.stringify(result.stories));
|
||||
if (!updated) return;
|
||||
|
||||
if (updated) {
|
||||
localForage.clear();
|
||||
result.stories.forEach((x, i) => {
|
||||
fetch('/api/' + x.id)
|
||||
.then(res => res.json())
|
||||
.then(result => {
|
||||
localForage.setItem(x.id, result.story)
|
||||
.then(console.log('preloaded', x.id, x.title));
|
||||
updateCache(x.id, result.story);
|
||||
}, error => {}
|
||||
);
|
||||
});
|
||||
}
|
||||
//setStories(result.stories);
|
||||
//localStorage.setItem('stories', JSON.stringify(result.stories));
|
||||
|
||||
//localForage.clear();
|
||||
//result.stories.forEach((x, i) => {
|
||||
// fetch('/api/' + x.id)
|
||||
// .then(res => res.json())
|
||||
// .then(result => {
|
||||
// localForage.setItem(x.id, result.story)
|
||||
// .then(console.log('preloaded', x.id, x.title));
|
||||
// updateCache(x.id, result.story);
|
||||
// }, error => {}
|
||||
// );
|
||||
//});
|
||||
},
|
||||
(error) => {
|
||||
setError(true);
|
||||
|
||||
Reference in New Issue
Block a user