25 lines
817 B
TypeScript
25 lines
817 B
TypeScript
// app/dashboard/page.tsx (Server Component)
|
|
import { auth } from "@/auth";
|
|
import { redirect } from "next/navigation";
|
|
import DashboardClient from "@/app/components/Dashboard"; // 기존 코드 대부분 이동
|
|
|
|
export default async function Page() {
|
|
const session = await auth();
|
|
if (!session) redirect("/login");
|
|
|
|
// 초기 데이터 서버에서 미리 가져오면 더 빠르고 안전 (예시)
|
|
// const [channels, contents] = await Promise.all([
|
|
// fetch(`${process.env.API_URL}/channels`, { cache: "no-store" }).then(r=>r.json()),
|
|
// fetch(`${process.env.API_URL}/contents`, { cache: "no-store" }).then(r=>r.json()),
|
|
// ]);
|
|
|
|
return (
|
|
<DashboardClient
|
|
// initialChannels={channels}
|
|
// initialContents={contents}
|
|
user={session.user} // id/email/name 등
|
|
/>
|
|
);
|
|
}
|
|
|