diff --git a/static/account.js b/static/account.js index 94b3f21..a443ae7 100644 --- a/static/account.js +++ b/static/account.js @@ -301,6 +301,9 @@ function renderHeader() { `; @@ -328,6 +331,13 @@ function renderHeader() { } }); el.querySelector(".acct-signout").addEventListener("click", logout); + const unlinkBtn = el.querySelector(".acct-discord-unlink"); + if (unlinkBtn) unlinkBtn.addEventListener("click", async () => { + unlinkBtn.disabled = true; + try { await apiFetch("api/v2/discord/unlink", { method: "POST" }); } catch (e) {} + await refreshUser(); + emitAuth(); // repaint the popover in its unlinked state + }); paintBadge(); paintNotifList(); startNotifPolling();