/* global React */ const { useState } = React; function LoginPage({ onLogin }) { const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const [error, setError] = useState(""); const [loading, setLoading] = useState(false); const submit = async (e) => { e.preventDefault(); setError(""); setLoading(true); try { const res = await window.api.login(email, password); if (res && res.access_token) { window.Auth.setToken(res.access_token); const user = await window.api.me(); if (user) window.Auth.setUser(user); onLogin(); } } catch (err) { setError(err.message || "Login failed"); } finally { setLoading(false); } }; return (
AURA
Sign in to your account to continue