import { useState, FormEvent } from 'react'; import { useNavigate, Link } from 'react-router-dom'; import { useAuthStore } from '../../stores/authStore'; import { useUIStore } from '../../stores/uiStore'; export function Login() { const [username, setUsername] = useState(''); const [password, setPassword] = useState(''); const { login, isLoading, error, clearError } = useAuthStore(); const { darkMode, toggleDarkMode } = useUIStore(); const navigate = useNavigate(); const handleSubmit = async (e: FormEvent) => { e.preventDefault(); clearError(); try { await login(username, password); navigate('/'); } catch (err) { // Error is handled by the store } }; return (

ISP Wiremap

Sign in to your account

{error && (
{error}
)}
setUsername(e.target.value)} required className="w-full px-4 py-3 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400 bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-gray-500 transition-colors" placeholder="Enter your username" disabled={isLoading} />
setPassword(e.target.value)} required className="w-full px-4 py-3 border border-gray-300 dark:border-gray-600 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400 bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-gray-500 transition-colors" placeholder="Enter your password" disabled={isLoading} />
Don't have an account? Create one
); }