import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { useAuth } from "@/hooks/useAuth"; import { Search, Settings, User, LogOut } from "lucide-react"; import { useState } from "react"; import MainContent from "@/components/MainContent"; import LoginModal from "@/components/LoginModal"; import SearchModal from "@/components/SearchModal"; import { useToast } from "@/hooks/use-toast"; import { queryClient } from "@/lib/queryClient"; export default function Home() { const { user, isAuthenticated } = useAuth(); const [isLoginModalOpen, setIsLoginModalOpen] = useState(false); const [isSearchModalOpen, setIsSearchModalOpen] = useState(false); const { toast } = useToast(); const handleLogout = async () => { try { const response = await fetch("/api/logout", { method: "POST", credentials: "include", }); if (response.ok) { toast({ title: "로그아웃 완료", description: "성공적으로 로그아웃되었습니다.", }); // Invalidate auth queries to refresh user state queryClient.invalidateQueries({ queryKey: ["/api/auth/user"] }); } } catch (error) { toast({ title: "로그아웃 오류", description: "로그아웃 중 오류가 발생했습니다.", variant: "destructive", }); } }; const handleAdminPage = () => { window.location.href = "/admin"; }; return (
window.location.href = "/"}
/>