import Link from "next/link"; import { redirect } from "next/navigation"; import { getSession } from "@/lib/auth"; import { db } from "@/lib/db"; export default async function NotificationsPage() { const user = await getSession(); if (!user) redirect("/login"); const notifications = db.prepare("SELECT n.*,u.username AS actor_username FROM notifications n LEFT JOIN users u ON u.id=n.actor_id WHERE n.user_id=? ORDER BY n.created_at DESC LIMIT 100").all(user.id) as any[]; return <>

通知

{notifications.length ? :

沒有通知。

}; }