38: 40: 41: 48: const d = await GET("/gmail/accounts"); 56: $("#btnConnect").addEventListener("click", async () => { 57: const btn = $("#btnConnect"); btn.disabled = true; btn.textContent = "Starting…"; 59: const d = await POST("/gmail/accounts/connect"); 67: toast("Connect failed: " + e.message, "err"); 73: $("#btnImportCfg").addEventListener("click", () => { 82: const d = await api("/gmail/accounts/import-config", { method: "POST", body: fd }); 84: toast(`Configuration imported (project: ${d.project_id}). You can now connect accounts.`, "ok"); 86: } catch (err) { toast("Import failed: " + err.message, "err"); } 90: $("#btnClearAll").addEventListener("click", () => { 92: const d = await POST("/gmail/accounts/clear-all"); 93: toast(`Cleared ${d.removed} account(s); revoked at Google: ${d.revoked_at_google}`, "ok"); 105: const d = await POST(`/gmail/accounts/${id}/test`); 106: if (d.ok) toast("Connection verified: " + (d.detail || "Gmail profile OK"), "ok"); 107: else toast("Test failed: " + (d.detail || d.error || "unknown"), "err"); 113: const d = await POST(`/gmail/accounts/${id}/reauthorize`); 118: } catch (err) { toast("Reauthorize failed: " + err.message, "err"); } 132: await api(`/gmail/accounts/${id}`, { method: "PATCH", body: payload }); 133: toast("Limits updated", "ok"); close(); await load(); 139: const d = await api(`/gmail/accounts/${id}`, { method: "DELETE" }); 140: toast(`Disconnected (revoked at Google: ${d.revoked_at_google})`, "ok"); 154: toast(`Gmail account connected: ${connectedEmail}`, "ok", 8000); === 160 /workspace/bulkmailer/static/js/pages/gmail-accounts.js