"use client"; import Link from "next/link"; import { useRouter } from "next/navigation"; import { FormEvent, useState } from "react"; export default function LoginPage() { const router = useRouter(); const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const [error, setError] = useState(null); const [loading, setLoading] = useState(false); const onSubmit = async (e: FormEvent) => { e.preventDefault(); setError(null); setLoading(true); const res = await fetch("/api/auth/login", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ email, password }), }); const data = await res.json(); setLoading(false); if (!res.ok) { setError(data?.error ?? "Login failed"); return; } router.push("/dashboard"); }; return (
{/* Geometric Decorations */}
{/* Accent Glow */}
{/* Login Card */}
{/* Header */}

Welcome back

Log in to upload and download files.

{/* Form */}
setEmail(e.target.value)} required autoComplete="email" />
setPassword(e.target.value)} required autoComplete="current-password" />
{error && (

{error}

)}
{/* Footer */}

No account yet?{" "} Create one

); }