"use client"; import { useState } from "react"; import { useRouter } from "next/navigation"; import { useAuth } from "../auth-context"; import { authFormStyles as styles } from "../styles/auth-form"; export default function LoginPage() { const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const [error, setError] = useState(""); const [isSubmitting, setIsSubmitting] = useState(false); const { login } = useAuth(); const router = useRouter(); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); setError(""); setIsSubmitting(true); try { await login(email, password); router.push("/"); } catch (err) { setError(err instanceof Error ? err.message : "Login failed"); } finally { setIsSubmitting(false); } }; return (

Welcome back

Sign in to your account

{error &&
{error}
}
setEmail(e.target.value)} style={styles.input} placeholder="you@example.com" required />
setPassword(e.target.value)} style={styles.input} placeholder="••••••••" required />

Don't have an account?{" "} Sign up

); }