import { useState } from 'react' import { login } from '../api' export default function Login({ onLogin }) { const [username, setUsername] = useState('') const [password, setPassword] = useState('') const [error, setError] = useState('') const [loading, setLoading] = useState(false) const handleSubmit = async (e) => { e.preventDefault() setLoading(true) setError('') try { const { token } = await login(username, password) onLogin(token) } catch (err) { setError('Invalid username or password') } finally { setLoading(false) } } return (

Gameserver Monitor

Sign in to your account

{error && (
{error}
)}
setUsername(e.target.value)} className="input" placeholder="Enter your username" required autoFocus />
setPassword(e.target.value)} className="input" placeholder="Enter your password" required />

Gameserver Monitor v2.0

) }