"use client" import { useState } from "react" import { useRouter } from "next/navigation" import Link from "next/link" export default function LoginPage() { const router = useRouter() const [form, setForm] = useState({ email: "", password: "" }) const [loading, setLoading] = useState(false) const [error, setError] = useState("") const handleSubmit = async (e: React.FormEvent) => { e.preventDefault() setLoading(true) setError("") try { const res = await fetch("/api/auth/login", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(form) }) if (res.ok) { router.push("/autojobs/dashboard") } else { setError("Invalid email or password") } } catch { setError("Network error") } setLoading(false) } return (
AutoJobs

Welcome back

{error && (
{error}
)}
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="••••••••" />

Don't have an account? Sign up free

) }