/** * @file app/(auth)/register/page.tsx * @description Client component providing a user registration interface utilizing the auth service. */ "use client"; import Link from "next/link"; import { useState } from "react"; import { useRouter } from "next/navigation"; import { registerUser } from "@/lib/services/auth.service"; /** * Renders the registration page featuring a sign-up form, error feedback, * and routing logic to the summary view upon successful account creation. * * @returns {JSX.Element} The rendered registration page component. */ export default function RegisterPage() { const [error, setError] = useState(null); const [loading, setLoading] = useState(false); const router = useRouter(); /** * Handles user registration form submission, validates form data via auth service, * and navigates to summary page on successful registration. * * @async * @param {React.SubmitEvent} event - The form submission event. */ async function handleSubmit(event: React.SubmitEvent) { event.preventDefault(); setError(null); setLoading(true); const formData = new FormData(event.currentTarget); const payload = Object.fromEntries(formData.entries()); const result = await registerUser(payload); if (result.error) { setError(result.error); setLoading(false); } else { router.push("/summary"); } } return (

Create an Account

Get started with your Flowstate Workspace.

{error && (
{error}
)}
Already have an account?{" "} Sign In
); }