"use client"; import { useState } from "react"; import { useRouter } from "next/navigation"; import { motion } from "framer-motion"; import { Ticket, LogIn } from "lucide-react"; export default function LoginPage() { const router = useRouter(); const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const [error, setError] = useState(null); const [loading, setLoading] = useState(false); async function handleSubmit(e: React.FormEvent) { e.preventDefault(); setLoading(true); setError(null); const res = await fetch("/api/auth/login", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ email, password }), }); if (!res.ok) { const data = await res.json().catch(() => null); setError(data?.error ?? "Не удалось войти"); setLoading(false); return; } router.push("/dashboard"); router.refresh(); } return (
top-tickets

Вход для агентов

Войдите, чтобы открыть дашборд заявок.

{error && ( {error} )}
); }