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