'use client'; import { useState } from 'react'; import { useRouter } from 'next/navigation'; import { UserPlus, User, Key, MessageSquare, Loader2 } from 'lucide-react'; import Link from 'next/link'; export default function RegisterPage() { const router = useRouter(); const [loading, setLoading] = useState(false); const [error, setError] = useState(''); const [formData, setFormData] = useState({ username: '', password: '', chatId: '' }); const handleRegister = async (e: React.FormEvent) => { e.preventDefault(); setLoading(true); setError(''); try { const res = await fetch('/api/auth/register', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(formData) }); const data = await res.json(); if (!res.ok) throw new Error(data.error || 'Error al registrarse'); router.push('/'); router.refresh(); } catch (err: any) { setError(err.message); } finally { setLoading(false); } }; return (
{/* Header */}

Crear Cuenta

Configura tu acceso a Finanzas

{error && (
{error}
)}
setFormData({...formData, username: e.target.value})} className="w-full pl-10 pr-4 py-2.5 bg-slate-950 border border-slate-800 rounded-lg text-white focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none transition-all placeholder:text-slate-600" placeholder="Elige un usuario" />
setFormData({...formData, password: e.target.value})} className="w-full pl-10 pr-4 py-2.5 bg-slate-950 border border-slate-800 rounded-lg text-white focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none transition-all placeholder:text-slate-600" placeholder="Mínimo 6 caracteres" minLength={6} />
setFormData({...formData, chatId: e.target.value})} className="w-full pl-10 pr-4 py-2.5 bg-slate-950 border border-slate-800 rounded-lg text-white focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none transition-all placeholder:text-slate-600" placeholder="Ej: 123456789" />

ℹ️ Envía /start a tu bot para obtener este ID.

¿Ya tienes cuenta?{' '} Inicia Sesión

); }