import { useState, type FormEvent } from 'react'; import { useNavigate } from 'react-router-dom'; import { toast } from 'sonner'; import { useAuthStore } from '../../store/useAuthStore'; import { Button } from '../ui/Button'; export function LoginPage() { const navigate = useNavigate(); const { login } = useAuthStore(); const [username, setUsername] = useState(''); const [password, setPassword] = useState(''); const [loading, setLoading] = useState(false); async function handleSubmit(e: FormEvent) { e.preventDefault(); if (!username.trim() || !password) return; setLoading(true); try { await login(username.trim(), password); navigate('/rack', { replace: true }); } catch (err) { toast.error(err instanceof Error ? err.message : 'Login failed'); } finally { setLoading(false); } } return (
Network infrastructure management
Credentials are set via Docker environment variables.