"use client"; import { useState, useEffect } from 'react'; import { useRouter } from 'next/navigation'; import { isAdminLoggedIn } from '../../lib/auth'; import LoginPage from '../login/page'; import Logout from '../../public/svg/logout'; interface Lecture { id: number; courseName: string; lectureName: string; attachedFile: string; questionCount: number; registrar: string; createdAt: string; } export default function AdminLecture2Page() { const router = useRouter(); const [isLoading, setIsLoading] = useState(true); const [isAuthenticated, setIsAuthenticated] = useState(false); const [lectures, setLectures] = useState([]); // 관리자 인증 확인 useEffect(() => { const checkAuth = () => { if (typeof window !== 'undefined') { const isAdmin = isAdminLoggedIn(); setIsAuthenticated(isAdmin); setIsLoading(false); if (!isAdmin) { // 인증되지 않은 경우 로그인 페이지로 리다이렉트 router.push('/login'); } } }; checkAuth(); }, [router]); if (isLoading) { return null; // 로딩 중 } if (!isAuthenticated) { return ; } return (
{/* 사이드바 */}
{/* 로고 */} {/* 메뉴 */}
{/* 로그아웃 */}
{/* 메인 콘텐츠 */}
{/* 헤더 */}

강좌 관리

{/* 강좌 등록 버튼 */} {/* 테이블 */}
{/* 테이블 헤더 */}

교육 과정명

강좌명

첨부 파일

학습 평가 문제 수

등록자

등록일

{/* 빈 상태 또는 테이블 바디 */} {lectures.length === 0 ? (

교육 과정을 추가해 주세요.

) : (
{lectures.map((lecture) => (

{lecture.courseName}

{lecture.lectureName}

{lecture.attachedFile}

{lecture.questionCount}

{lecture.registrar}

{lecture.createdAt}

))}
)}
); }