"use client"; import { useRouter } from "next/navigation"; import { useState } from "react"; import { useAuthContext } from "@/hooks/auth-context"; export default function RegisterPage() { const router = useRouter(); const [email, setEmail] = useState(""); const [displayName, setDisplayName] = useState(""); const [password, setPassword] = useState(""); const [error, setError] = useState(""); const { register, loading } = useAuthContext(); async function onSubmit(e: React.FormEvent) { e.preventDefault(); setError(""); const result = await register({ email, password, displayName }); if (!result.ok) { setError(result.error || "Registration failed"); return; } router.replace("/"); } return (

Register

{error ?
{error}
: null}
Already have an account?{" "} Login
); }