"use client"; import { useState } from "react"; import { useRouter } from "next/navigation"; import { Eye, EyeOff } from "lucide-react"; export default function AdminLoginPage() { const [password, setPassword] = useState(""); const [error, setError] = useState(""); const [loading, setLoading] = useState(false); const [showPassword, setShowPassword] = useState(false); const router = useRouter(); async function handleSubmit(e: React.FormEvent) { e.preventDefault(); setError(""); setLoading(true); try { const res = await fetch("/api/auth/login", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ password }), }); if (res.ok) { router.push("/admin"); } else { setError("Неверный пароль"); } } catch { setError("Ошибка соединения"); } finally { setLoading(false); } } return (