관리자 계정 설정, 관리자 페이지 작업1

This commit is contained in:
wallace
2025-11-13 15:02:43 +09:00
parent c81f218a2b
commit 8403684df3
20 changed files with 1571 additions and 46 deletions

View File

@@ -0,0 +1,49 @@
"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 <LoginPage />;
}
return (
<div className="bg-white relative size-full min-h-screen">
<div className="flex items-center justify-center min-h-screen">
<div className="text-center">
<h1 className="text-2xl font-bold text-[#404040] mb-4"> </h1>
<p className="text-[#515151]"> .</p>
</div>
</div>
</div>
);
}