import { $, api, toast } from "./common.js"; $("#go").addEventListener("click", async (e) => { e.target.disabled = true; try { const r = await api("POST", "/api/trial"); location.href = `/screen/${r.id}#${r.screen_key}`; } catch (err) { toast(err.code === "too_many_trials" ? "Trop d'essais en cours, réessayez plus tard" : `Erreur : ${err.message}`, "bad"); e.target.disabled = false; } });