"use client"; import { useState } from "react"; import { useRouter } from "next/navigation"; import { AuthCard, AuthFooterLink } from "@/components/auth/auth-card"; import { useAuth } from "@/components/auth/auth-provider"; import { AuthError } from "@/lib/auth"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; export default function SignUpPage() { const router = useRouter(); const { signUp } = useAuth(); const [name, setName] = useState(""); const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const [error, setError] = useState(null); const [submitting, setSubmitting] = useState(false); async function onSubmit(e: React.SyntheticEvent) { e.preventDefault(); setError(null); setSubmitting(true); try { await signUp(email, password, name); router.push("/profile"); router.refresh(); } catch (err) { setError(err instanceof AuthError ? err.message : "Sign-up failed."); setSubmitting(false); } } return ( } >
setName(e.target.value)} />
setEmail(e.target.value)} />
setPassword(e.target.value)} />

At least 8 characters.


{error ?

{error}

: null}
); }