"use client" import { useState } from "react" import { useRouter } from "next/navigation" import { authClient } from "@/lib/auth-client" export default function RegisterPage() { const [email, setEmail] = useState("") const [password, setPassword] = useState("") const [name, setName] = useState("") const [loading, setLoading] = useState(false) const [error, setError] = useState("") const router = useRouter() const handleRegister = async (e: React.FormEvent) => { e.preventDefault() setLoading(true) setError("") const { error: err } = await authClient.signUp.email({ email, password, name: name || "", }) if (err) { setError(err.message || "Error al registrarse") setLoading(false) return } router.push("/parent") } return (