diff --git a/frontend/www/src/modules/auth.ts b/frontend/www/src/modules/auth.ts index 68a8b52..401ea1e 100644 --- a/frontend/www/src/modules/auth.ts +++ b/frontend/www/src/modules/auth.ts @@ -2,6 +2,7 @@ import { Transaction } from "common/types"; import { ebsFetch } from "../util/ebs"; import { hideProcessingModal, openModal, showErrorModal, showSuccessModal, transactionToken } from "./modal"; import { logToDiscord } from "../util/logger"; +import { renderRedeemButtons } from "./redeems"; const $loginPopup = document.getElementById("onboarding")!; const $loginButton = document.getElementById("twitch-login")!; @@ -9,7 +10,10 @@ const $loginButton = document.getElementById("twitch-login")!; document.addEventListener("DOMContentLoaded", () => ($loginButton.onclick = Twitch.ext.actions.requestIdShare)); Twitch.ext.onAuthorized(() => { - if (Twitch.ext.viewer.id) $loginPopup.style.display = "none"; + $loginPopup.style.display = Twitch.ext.viewer.id ? "none" : ""; + if (Twitch.ext.viewer.id) { + renderRedeemButtons().then(); + } }); Twitch.ext.bits.onTransactionComplete(async (transaction) => { diff --git a/frontend/www/src/modules/redeems.ts b/frontend/www/src/modules/redeems.ts index 7c4e4be..c282b32 100644 --- a/frontend/www/src/modules/redeems.ts +++ b/frontend/www/src/modules/redeems.ts @@ -5,10 +5,6 @@ const $mainContainer = document.getElementsByTagName("main")!; const $redeemContainer = document.getElementById("items")!; const $modalProcessing = document.getElementById("modal-processing")!; -document.addEventListener("DOMContentLoaded", () => { - renderRedeemButtons().then(); -}); - export async function renderRedeemButtons() { $redeemContainer.innerHTML = `

Loading content...

`;