import { useState } from 'react'; import { useRouter } from 'next/router'; import Head from 'next/head'; import { useAuth } from '../contexts/AuthContext'; const Login = () => { const [username, setUsername] = useState(''); const [password, setPassword] = useState(''); const [error, setError] = useState(''); const { login } = useAuth(); const router = useRouter(); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); setError(''); try { await login(username, password); router.push('/dashboard'); // Assuming a dashboard route after login } catch (err) { setError('Credenciales inválidas. Inténtalo de nuevo.'); } }; return (
Inteligencia Artificial para tu Panadería
{/* Added tagline and tech blue color */}