// components/LoginPage.tsx import React, { useState } from 'react'; import { motion } from 'framer-motion'; import { Lock, User } from 'lucide-react'; import toast from 'react-hot-toast'; import { useAuth } from '../utils/AuthContext'; const LoginPage: React.FC = () => { const { login } = useAuth(); const [username, setUsername] = useState(''); const [password, setPassword] = useState(''); const [isSubmitting, setIsSubmitting] = useState(false); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); if (!username || !password) { toast.error('Introduce usuario y contraseña'); return; } setIsSubmitting(true); try { await login(username, password); toast.success('Sesión iniciada'); } catch (err) { console.error('Error en login', err); const msg = err instanceof Error ? err.message : 'Error al iniciar sesión'; toast.error(msg); } finally { setIsSubmitting(false); } }; return (

Beyond Diagnostic

Inicia sesión para acceder al análisis

setUsername(e.target.value)} />
setPassword(e.target.value)} />

La sesión permanecerá activa durante 1 hora.

); }; export default LoginPage;