import { useState } from 'react'; import { useHospitalStore } from '@/hooks/useHospitalStore'; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; import { Lock, User, Hospital } from 'lucide-react'; export function Login() { const { login } = useHospitalStore(); const [dni, setDni] = useState(''); const [password, setPassword] = useState(''); const [error, setError] = useState(''); const [loading, setLoading] = useState(false); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); setError(''); setLoading(true); try { await login(dni, password); window.location.reload(); } catch (err) { setError(err instanceof Error ? err.message : 'Error de autenticación'); } finally { setLoading(false); } }; return (
Sistema de Gestión Hospitalaria Ingrese sus credenciales para acceder
setDni(e.target.value)} className="pl-10" required />
setPassword(e.target.value)} className="pl-10" required />
{error && (
{error}
)}
); }