import { useState } from "react"; import { invoke } from "@tauri-apps/api/core"; import { useNavigate } from "react-router-dom"; export default function LoginPage() { const [email, setEmail] = useState(""); const [error, setError] = useState(null); const [loading, setLoading] = useState(false); const navigate = useNavigate(); async function handleLogin() { setError(null); setLoading(true); try { await invoke("login", { email }); navigate("/workspaces"); } catch (e) { setError(String(e)); } finally { setLoading(false); } } return (

Rustification

setEmail(e.target.value)} onKeyDown={(e) => e.key === "Enter" && handleLogin()} placeholder="Email address" style={{ display: "block", width: "100%", marginBottom: 12, padding: 8, boxSizing: "border-box" }} /> {error &&

{error}

}
); }