"use client" import { useState } from "react" import { useRouter } from "next/navigation" import Link from "next/link" export default function SignupPage() { const router = useRouter() const [form, setForm] = useState({ name: "", email: "", password: "", confirmPassword: "" }) const [loading, setLoading] = useState(false) const [error, setError] = useState("") const handleSubmit = async (e: React.FormEvent) => { e.preventDefault() if (form.password !== form.confirmPassword) { setError("Passwords don't match") return } setLoading(true) setError("") try { const res = await fetch("/api/auth/signup", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ name: form.name, email: form.email, password: form.password }) }) if (res.ok) { router.push("/autojobs/profile-setup") } else { const data = await res.json() setError(data.error || "Signup failed") } } catch { setError("Network error") } setLoading(false) } return (
AutoJobs

Create your account

{error && (
{error}
)}
setForm({...form, name: e.target.value})} className="w-full px-4 py-3 bg-slate-700 border border-slate-600 rounded-xl text-white placeholder-slate-500 focus:outline-none focus:border-blue-500" placeholder="John Smith" />
setForm({...form, email: e.target.value})} className="w-full px-4 py-3 bg-slate-700 border border-slate-600 rounded-xl text-white placeholder-slate-500 focus:outline-none focus:border-blue-500" placeholder="you@example.com" />
setForm({...form, password: e.target.value})} className="w-full px-4 py-3 bg-slate-700 border border-slate-600 rounded-xl text-white placeholder-slate-500 focus:outline-none focus:border-blue-500" placeholder="••••••••" />
setForm({...form, confirmPassword: e.target.value})} className="w-full px-4 py-3 bg-slate-700 border border-slate-600 rounded-xl text-white placeholder-slate-500 focus:outline-none focus:border-blue-500" placeholder="••••••••" />

Already have an account? Sign in

) }