import { useState } from 'react'; type Props = { onLogin: (token: string) => void }; export function LoginPage({ onLogin }: Props) { const [username, setUsername] = useState('admin'); const [password, setPassword] = useState('admin123'); const [error, setError] = useState(''); const [loading, setLoading] = useState(false); const submit = async (e: React.FormEvent) => { e.preventDefault(); setLoading(true); setError(''); try { const body = new URLSearchParams(); body.set('username', username); body.set('password', password); const res = await fetch('/auth/token', { method: 'POST', body }); if (!res.ok) throw new Error('Login fallito'); const data = await res.json(); onLogin(data.access_token); } catch (err) { setError(err instanceof Error ? err.message : 'Login fallito'); } finally { setLoading(false); } }; return

NetMapper auth

Accedi al book of truth

L'accesso รจ protetto per impedire lettura e modifica dei dati da terzi.

{error &&

{error}

}
; }