feat: add ability to mark individual posts as read, close #114

This commit is contained in:
Xyphyn committed 2023-08-19 14:13:30 -07:00
1 parent 0be27d8eee
commit 79221e2e53
3 files changed
+32 -3

No files matched your search

+19
View File
@@ -140,3 +140,22 @@ export async function vote(
}
return 0
}
export async function markAsRead(
item: ContentView | Submission,
read: boolean,
jwt: string
): Promise<boolean> {
if (isSubmission(item)) item = contentItem(item)
if (item.type == 'post') {
return (
await getClient().markPostAsRead({
auth: jwt,
post_id: item.id,
read: read,
})
).post_view.read
}
return false
}