first commit
This commit is contained in:
24
app/usr/1_dashboard/page.tsx
Normal file
24
app/usr/1_dashboard/page.tsx
Normal file
@@ -0,0 +1,24 @@
|
||||
// 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 등
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user