feat: get unreads
This commit is contained in:
@@ -43,6 +43,22 @@ declare const routes: hono_hono_base.HonoBase<hono.Env, {
|
||||
outputFormat: "json";
|
||||
status: 200;
|
||||
};
|
||||
$get: {
|
||||
input: {
|
||||
query: {
|
||||
view: string;
|
||||
};
|
||||
};
|
||||
output: {
|
||||
code: 0;
|
||||
data: {
|
||||
feedId: string;
|
||||
unread: number;
|
||||
}[];
|
||||
};
|
||||
outputFormat: "json";
|
||||
status: 200;
|
||||
};
|
||||
};
|
||||
} & {
|
||||
"/collections": {
|
||||
|
||||
@@ -21,6 +21,10 @@ export const subscription = {
|
||||
await apiClient.subscriptions.$get({ query: { view: String(view) } })
|
||||
).json()
|
||||
|
||||
const unreads = await (
|
||||
await apiClient.reads.$get({ query: { view: String(view) } })
|
||||
).json()
|
||||
|
||||
const subscriptions = res.data as SubscriptionResponse
|
||||
const categories = {
|
||||
list: {},
|
||||
@@ -69,8 +73,7 @@ export const subscription = {
|
||||
unread: 0,
|
||||
}
|
||||
}
|
||||
// const unread = counters.unreads[feed.id] || 0
|
||||
const unread = 0
|
||||
const unread = unreads.data.find((x) => x.feedId === subscription.feedId)?.unread || 0
|
||||
subscription.unread = unread
|
||||
categories.list[subscription.category].list.push(subscription)
|
||||
categories.list[subscription.category].unread += unread
|
||||
|
||||
Reference in New Issue
Block a user