import { getServerSession } from "next-auth"; import { authOptions } from "@/lib/auth-options"; import { FormLayoutClient, LoginButton } from "./client"; import { Metadata } from "next"; import { ThemeToggle } from "@/components/theme-toggle"; import { getSessionDiscordId } from "@/lib/auth"; import { getDiscordMemberProfile } from "@/lib/discord"; import Link from 'next/link'; const siteUrl = process.env.BASE_URL; export const metadata: Metadata = { title: "กรอกแบบฟอร์ม", openGraph: { type: "website", locale: "th_TH", url: siteUrl, siteName: "Form", title: "กรอกแบบฟอร์ม", description: "Custom form ของเว็บไซด์", images: [ { url: "/avatar.webp", width: 512, height: 512, alt: "Erika! avatar", }, ], }, } export default async function FormLayout({ children, }: { children: React.ReactNode; }) { const session = await getServerSession(authOptions); const discordId = getSessionDiscordId(session); let profile = null; if (discordId) { profile = await getDiscordMemberProfile(discordId); } return (
Form
{session?.user ? ( ) : ( )}
{children}
); }