'use client'; import { useState } from 'react'; import { useRouter } from 'next/navigation'; import Cookies from 'js-cookie'; export default function LoginPage() { const [username, setUsername] = useState(''); const [password, setPassword] = useState(''); const [error, setError] = useState(''); const router = useRouter(); const handleLogin = async (e: React.FormEvent) => { e.preventDefault(); // For demo purposes, using hardcoded credentials // In production, this should be replaced with proper authentication if (username === 'admin' && password === 'admin123') { // Set authentication cookie Cookies.set('isAuthenticated', 'true', { path: '/' }); router.push('/dashboard'); } else { setError('Invalid username or password'); } }; return (