import type { Metadata } from "next"; import { Suspense } from "react"; import { cookies } from "next/headers"; import FriendLinksAdmin from "./FriendLinksAdmin"; import { authCookieHeader } from "@/lib/cookies"; import { fetchAdminFriendLinks, type FriendLink } from "@/lib/api"; import { getMeCached } from "@/lib/serverData"; import { isSuperOrOwner } from "@/lib/roles"; import Forbidden from "../Forbidden"; export const metadata: Metadata = { title: "友情链接管理", }; export default async function AdminFriendLinksPage() { const cookie = authCookieHeader(await cookies()); const me = await getMeCached(cookie || undefined); if (!me.user || !isSuperOrOwner(me.user.role)) { return ; } let links: FriendLink[] = []; let initError = ""; try { const res = await fetchAdminFriendLinks(cookie || undefined); links = res.links ?? []; } catch (e) { initError = e instanceof Error ? e.message : "加载失败"; } return ( 加载中…

}>
); }