mark all as read
This commit is contained in:
@@ -159,6 +159,18 @@ function setInitialLoad(value) {
|
||||
initialLoad = value
|
||||
}
|
||||
|
||||
async function markAllRead() {
|
||||
if (feeds.value.length === 0) return
|
||||
if (!window.confirm('Mark all articles as read?')) return
|
||||
|
||||
const ids = feeds.value.map(feed => feed.id)
|
||||
feeds.value = []
|
||||
currentIndex.value = 0
|
||||
// markRead swallows its own errors, so Promise.all can't reject here.
|
||||
await Promise.all(ids.map(id => markRead(id)))
|
||||
showMessageForXSeconds('All articles marked as read.', 5)
|
||||
}
|
||||
|
||||
function markCurrentArticleRead() {
|
||||
const feed = feeds.value[currentIndex.value]
|
||||
// Marking read here (rather than via removeFeed, as the scroll-based list
|
||||
@@ -203,6 +215,7 @@ export function useFeeds() {
|
||||
sync,
|
||||
getReadable,
|
||||
markRead,
|
||||
markAllRead,
|
||||
showMessageForXSeconds,
|
||||
setupIntersectionObserver,
|
||||
removeFeed,
|
||||
|
||||
Reference in New Issue
Block a user