9 lines
778 B
TypeScript
9 lines
778 B
TypeScript
import "./styles.css";
|
|
import Link from "next/link";
|
|
import { getSession } from "@/lib/auth";
|
|
export const metadata = { title: "Mebbling", description: "Your Memos hub" };
|
|
export default async function RootLayout({ children }: { children: React.ReactNode }) {
|
|
const user = await getSession();
|
|
return <html lang="zh-Hant"><body><header><Link href="/" className="brand">Mebbling</Link><nav><Link href="/">探索</Link>{user ? <><Link href="/dashboard">控制台</Link><Link href="/account">帳號</Link>{user.role === "admin" && <Link href="/admin">管理</Link>}<form action="/api/auth/logout" method="post"><button>登出</button></form></> : <><Link href="/login">登入</Link><Link href="/register">註冊</Link></>}</nav></header><main>{children}</main></body></html>;
|
|
}
|