Fix unread count

This commit is contained in:
Marcus Noble 2020-11-18 19:12:31 +00:00
parent 649595ed14
commit c836fe576d

View File

@ -186,6 +186,7 @@
window.location.hash = feed; window.location.hash = feed;
}, },
loadItem(item) { loadItem(item) {
this.setBusy(true);
if (this.selectedItem === item.ID) { if (this.selectedItem === item.ID) {
this.selectedItem = undefined; this.selectedItem = undefined;
} else { } else {
@ -194,6 +195,7 @@
item.PendingRead = true; item.PendingRead = true;
fetch(`/api/read/${item.ID}`, {method: "POST"}) fetch(`/api/read/${item.ID}`, {method: "POST"})
} }
this.setBusy(false);
}, },
saveItem(item) { saveItem(item) {
this.setBusy(true); this.setBusy(true);
@ -338,7 +340,7 @@
this.setBusy(true); this.setBusy(true);
Promise.all([ Promise.all([
fetch(`/api/feeds`).then(res => res.json()).then(feeds => this.feeds = feeds), fetch(`/api/feeds`).then(res => res.json()).then(feeds => this.feeds = feeds),
fetch(`/api/unread`).then(res => res.json()).then(items => this.items = items), fetch(`/api/unread`).then(res => res.json()).then(items => this.items = items.map(item => {item.PendingRead = false; return item;})),
fetch(`/api/saved`).then(res => res.json()).then(items => this.savedItems = items) fetch(`/api/saved`).then(res => res.json()).then(items => this.savedItems = items)
]) ])
.then(() => { .then(() => {