임동욱 임동욱 08-10
feat: 학생 회원 라우트 골격 추가
Co-Authored-By: Claude Sonnet 5 
@361dea6b54dfbf95249f46dcea57fa8b9929e22b
 
app/(protected)/(basic)/students/error.tsx (added)
+++ app/(protected)/(basic)/students/error.tsx
@@ -0,0 +1,32 @@
+'use client';
+
+import { useEffect } from 'react';
+
+interface ErrorPageProps {
+  error: Error & { digest?: string };
+  unstable_retry: () => void;
+}
+
+// 원본 메시지·스택은 화면에 내지 않는다 — 개발자 진단용으로만 콘솔에 남기고(프로덕션에서는
+// Next.js가 Server Component 에러를 이미 digest 포함 일반화 메시지로 치환해 전달한다),
+// 사용자에게는 일반화된 문구 + 재시도만 제공한다. Next.js 16.2 문서 권고에 따라 세그먼트
+// 재조회까지 수행하는 `unstable_retry()`를 `reset()` 대신 사용한다.
+export default function ErrorPage({ error, unstable_retry }: ErrorPageProps) {
+  useEffect(() => {
+    console.error(error);
+  }, [error]);
+
+  return (
+    <section className="flex flex-1 flex-col items-center justify-center gap-2 p-8">
+      <h1 className="text-lg text-foreground">문제가 발생했습니다.</h1>
+      <p className="text-sm text-foreground/60">잠시 후 다시 시도해 주세요.</p>
+      <button
+        type="button"
+        onClick={() => unstable_retry()}
+        className="mt-4 bg-foreground px-4 py-2 text-background"
+      >
+        다시 시도
+      </button>
+    </section>
+  );
+}
 
app/(protected)/(basic)/students/loading.tsx (added)
+++ app/(protected)/(basic)/students/loading.tsx
@@ -0,0 +1,12 @@
+import { Spinner } from '@/components/ui/spinner';
+
+// page.tsx가 스트리밍되는 동안의 폴백 — 같은 section 배치(flex-1 items-center justify-center)를
+// 써서 콘텐츠 교체 시 레이아웃이 흔들리지 않게 한다. Server Component로 충분해 'use client'를
+// 붙이지 않는다.
+export default function Loading() {
+  return (
+    <section className="flex flex-1 flex-col items-center justify-center gap-2 p-8">
+      <Spinner size="lg" />
+    </section>
+  );
+}
 
app/(protected)/(basic)/students/page.tsx (added)
+++ app/(protected)/(basic)/students/page.tsx
@@ -0,0 +1,18 @@
+import type { Metadata } from 'next';
+import { verifySession } from '@/lib/auth/dal';
+
+export const metadata: Metadata = {
+  title: '학생 회원',
+};
+
+// 목록·상세는 이번 범위 밖 — 라우트 골격만 제공한다 (§4.1 승인 범위 한정).
+export default async function Page() {
+  await verifySession();
+
+  return (
+    <section className="flex flex-1 flex-col items-center justify-center gap-2 p-8">
+      <h1 className="text-lg text-foreground">학생 회원</h1>
+      <p className="text-sm text-foreground/60">준비 중인 화면입니다.</p>
+    </section>
+  );
+}
Add a comment
List