import { useState } from "react"; import { useNavigate, Form, Link } from "react-router"; import { authClient } from "~/lib/auth-client"; import { Input } from "~/components/ui/input"; import { Button } from "~/components/ui/button"; export default function Login() { const navigate = useNavigate(); const [error, setError] = useState(null); const [pending, setPending] = useState(false); async function onSubmit(event: React.FormEvent) { event.preventDefault(); setError(null); setPending(true); const formData = new FormData(event.currentTarget); const { error } = await authClient.signIn.email({ email: String(formData.get("email")), password: String(formData.get("password")), }); setPending(false); if (error) { setError(error.message ?? "Could not log in."); return; } navigate("/"); } return (
Log in Continue to Coppie.
{error ?

{error}

: null}

No account?{" "} Sign up

); }