"use client"; import { useState } from "react"; import { lmsApi } from "@/lib/api"; import { useAuth } from "@/context/AuthContext"; import { useRouter } from "next/navigation"; import Link from "next/link"; import { UserPlus, Mail, Lock, User, Building2 } from "lucide-react"; export default function RegisterPage() { const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const [fullName, setFullName] = useState(""); const [organizationName, setOrganizationName] = useState(""); const [error, setError] = useState(""); const [loading, setLoading] = useState(false); const { login } = useAuth(); const router = useRouter(); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); setLoading(true); setError(""); try { const res = await lmsApi.register({ email, password, full_name: fullName, organization_name: organizationName }); login(res.user, res.token); router.push("/"); } catch (err) { const message = err instanceof Error ? err.message : "Registration failed. Please try again."; setError(message); } finally { setLoading(false); } }; return (

Create Account

Join the next generation of learners

{error && (
{error}
)}
setFullName(e.target.value)} placeholder="John Doe" className="w-full bg-white/5 border border-white/10 rounded-xl py-4 pl-12 pr-4 text-sm text-white focus:outline-none focus:border-blue-500 transition-all" />
setEmail(e.target.value)} placeholder="name@company.com" className="w-full bg-white/5 border border-white/10 rounded-xl py-4 pl-12 pr-4 text-sm text-white focus:outline-none focus:border-blue-500 transition-all" />
setPassword(e.target.value)} placeholder="••••••••" className="w-full bg-white/5 border border-white/10 rounded-xl py-4 pl-12 pr-4 text-sm text-white focus:outline-none focus:border-blue-500 transition-all" />
setOrganizationName(e.target.value)} placeholder="Your School or Company" className="w-full bg-white/5 border border-white/10 rounded-xl py-4 pl-12 pr-4 text-sm text-white focus:outline-none focus:border-blue-500 transition-all" />

If blank, we'll use your email domain.

Already have an account? Login here

); }