import { useAuthActions } from "@convex-dev/auth/react"; import { useState } from "react"; export function SignIn() { const { signIn } = useAuthActions(); const [step, setStep] = useState<"signIn" | "signUp">("signIn"); const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const [error, setError] = useState(null); const handleSubmit = async (event: React.FormEvent) => { event.preventDefault(); setError(null); try { const flow = step === "signIn" ? "signIn" : "signUp"; await signIn("password", { email, password, flow }); } catch (err) { setError("Error signing in"); console.error(err); } }; return (

{step === "signIn" ? "Sign In" : "Sign Up"}

{error &&
{error}
}
setEmail(e.target.value)} className="border p-2 rounded outline-none focus:ring-2 focus:ring-blue-500" required /> setPassword(e.target.value)} className="border p-2 rounded outline-none focus:ring-2 focus:ring-blue-500" required minLength={8} />
); }