"use client"; import { useState, type FormEvent } from "react"; import { apiFetch, errorMessage } from "@/lib/client-api"; export default function LoginPage() { const [username, setUsername] = useState(""); const [password, setPassword] = useState(""); const [error, setError] = useState(""); const [busy, setBusy] = useState(false); async function submit(e: FormEvent) { e.preventDefault(); setBusy(true); setError(""); try { await apiFetch("/auth/login", { method: "POST", body: { username, password } }); const next = new URLSearchParams(window.location.search).get("next"); window.location.href = next && next.startsWith("/") && !next.startsWith("//") ? next : "/"; } catch (err) { setError(errorMessage(err)); setBusy(false); } } return (

Bot de Pontos

Painel administrativo

{error &&

{error}

}
); }