"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 (

BLACK HEART

Панель управления

setPassword(e.target.value)} className="w-full rounded-lg border border-neutral-200 bg-neutral-100 px-4 py-3 pr-11 text-neutral-900 placeholder-neutral-400 outline-none focus:border-gold transition-colors dark:border-white/10 dark:bg-neutral-800 dark:text-white dark:placeholder-neutral-500" placeholder="Введите пароль" autoFocus aria-describedby={error ? "login-error" : undefined} />
{error && ( )}
); }