import { getServerSession } from "next-auth" import { authOptions } from "@/lib/auth" import Link from "next/link" import { Sparkles } from "lucide-react" import { cookies } from "next/headers" const readerApiOrigin = (process.env.READER_API_ORIGIN || "http://localhost:8000").replace(/\/+$/, "") export default async function ModDashboardPage() { const session = await getServerSession(authOptions) let novelCount = 0 let totalViews = 0 let commentCount = 0 let seriesCount = 0 try { const cookieHeader = (await cookies()).toString() const res = await fetch(`${readerApiOrigin}/api/mod/overview`, { cache: "no-store", headers: cookieHeader ? { cookie: cookieHeader } : undefined, }) if (res.ok) { const data = await res.json() novelCount = Number(data?.novelCount || 0) totalViews = Number(data?.totalViews || 0) commentCount = Number(data?.commentCount || 0) seriesCount = Number(data?.seriesCount || 0) } } catch (error) { console.error("Failed to fetch mod overview", error) } return (
Chào mừng bạn đến với trang quản trị dành cho Moderator.
{novelCount}
{totalViews}
{commentCount}
{seriesCount}
Công cụ AI hỗ trợ tìm kiếm và tự bổ sung thông tin truyện vào form quản lý.
Mở AI Tool