"use client" import { useState } from "react" import { Button } from "@/components/ui/button" import { Input } from "@/components/ui/input" import { Card, CardContent, CardHeader, CardTitle, CardDescription, CardFooter } from "@/components/ui/card" import { Label } from "@/components/ui/label" import { getApiUrl } from "@/lib/api-config" import Link from "next/link" export default function RegisterPage() { const [email, setEmail] = useState("") const [username, setUsername] = useState("") const [password, setPassword] = useState("") const [error, setError] = useState("") const [loading, setLoading] = useState(false) const [success, setSuccess] = useState(false) const handleSubmit = async (e: React.FormEvent) => { e.preventDefault() setLoading(true) setError("") try { // Register const res = await fetch(`${getApiUrl()}/auth/register`, { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ email, username, password }), }) if (!res.ok) { const data = await res.json() throw new Error(data.detail || "Registration failed") } // Show success message instead of auto-login setSuccess(true) } catch (err: any) { setError(err.message) } finally { setLoading(false) } } if (success) { return (
Check Your Email We've sent a verification link to {email}

Click the link in the email to verify your account and complete registration.

Didn't receive it? Check your spam folder or{" "} try logging in {" "}to resend.

) } return (
Create Account Join the community to track shows and rate sets
{error && (
{error}
)}
setEmail(e.target.value)} required />
setUsername(e.target.value)} required />
setPassword(e.target.value)} required />

Already have an account?{" "} Sign in

) }