"use client"; import { useEffect, useState } from 'react'; import { useRouter } from 'next/navigation'; import { isAdminLoggedIn } from '../../lib/auth'; import LoginPage from '../login/page'; export default function AdminHomePage() { const router = useRouter(); const [isLoading, setIsLoading] = useState(true); const [isAuthenticated, setIsAuthenticated] = useState(false); 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 (

관리자 홈

관리자 페이지에 오신 것을 환영합니다.

); }