"use client"; import { useState } from "react"; export default function AdminLoginPage() { const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const [errorText, setErrorText] = useState(""); const [isLoading, setIsLoading] = useState(false); async function handleSubmit(e: React.FormEvent) { e.preventDefault(); setErrorText(""); setIsLoading(true); try { const response = await fetch("/api/admin/login", { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ email, password }), }); const data = await response.json(); if (!response.ok) { setErrorText(data.error || "Ошибка входа"); return; } window.location.href = "/admin/leads"; } catch { setErrorText("Ошибка сети"); } finally { setIsLoading(false); } } return (

Вход в CRM

WorkParking CRM

setEmail(e.target.value)} className="w-full rounded-2xl border border-white/10 bg-black/30 px-4 py-3 outline-none focus:border-emerald-500" required /> setPassword(e.target.value)} className="w-full rounded-2xl border border-white/10 bg-black/30 px-4 py-3 outline-none focus:border-emerald-500" required /> {errorText &&

{errorText}

}
); }