'use client'; import { useState } from 'react'; import { useRouter } from 'next/navigation'; import { register } from './api'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from '@/components/ui/card'; import Link from 'next/link'; import { Zap, Mail, Lock, ArrowRight, Loader2, UserPlus } from 'lucide-react'; export function RegisterForm() { const router = useRouter(); const [loading, setLoading] = useState(false); const [error, setError] = useState(''); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); setLoading(true); setError(''); const formData = new FormData(e.currentTarget); const data = Object.fromEntries(formData.entries()); // Validate passwords match if (data.password !== data.confirmPassword) { setError('Passwords do not match'); setLoading(false); return; } try { await register(data); router.push('/login?registered=true'); } catch (err: any) { console.error(err); setError(err.response?.data?.message || 'Registration failed. Please try again.'); } finally { setLoading(false); } }; return (
{/* Animated Background Elements */}
Create Account Join wexts today
{error && (
⚠️ {error}
)}
Already have an account?{' '} Sign in

© 2025 wexts Inc. All rights reserved.

); }