Skip to content

Commit

Permalink
fix auth flow maybe
Browse files Browse the repository at this point in the history
  • Loading branch information
Govorunb committed Jun 11, 2024
1 parent 908b87f commit 11535b0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 5 additions & 1 deletion frontend/www/src/modules/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@ 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")!;

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) => {
Expand Down
4 changes: 0 additions & 4 deletions frontend/www/src/modules/redeems.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = `<div class="redeems-content-spinner"><div class="spinner"></div><p>Loading content...</p></div>`;

Expand Down

0 comments on commit 11535b0

Please sign in to comment.