"use client"; import { useState } from "react"; import { useRouter } from "next/navigation"; export default function Login() { const [username, setUsername] = useState(""); const [password, setPassword] = useState(""); const [error, setError] = useState(""); const router = useRouter(); const handleSubmit = async (e) => { e.preventDefault(); // Simple validation if (!username || !password) { setError("Username and password are required"); return; } // Set login cookie (expires in 24 hours) document.cookie = `next_username=${username}; path=/; max-age=${ 60 * 60 }; SameSite=Strict`; document.cookie = `next_password=${password}; path=/; max-age=${ 60 * 60 }; SameSite=Strict`; console.log("Cookie set", username, password); router.push("/"); // Redirect to dashboard }; return (

Admin Login

{error && (
{error}
)}
setUsername(e.target.value)} />
setPassword(e.target.value)} />

Demo credentials: admin / password

); }