11 lines
308 B
TypeScript

import { getNotifications, countUnread } from "../../db/notifications";
export default defineEventHandler(async (event) => {
const user = await requireUser(event);
const [items, unread] = await Promise.all([
getNotifications(user.id),
countUnread(user.id),
]);
return { items, unread };
});