From 39d88019e82c8fb79ac833d4b6d2b2ace299fbec Mon Sep 17 00:00:00 2001 From: Ian Gulliver Date: Mon, 29 Dec 2025 12:48:33 -0800 Subject: [PATCH] Load GSI client dynamically from app.js --- static/app.js | 22 +++++++--------------- static/index.html | 1 - 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/static/app.js b/static/app.js index 7419603..852daa4 100644 --- a/static/app.js +++ b/static/app.js @@ -26,20 +26,12 @@ function bind(data) { }); } -function waitForGoogle() { - return new Promise((resolve) => { - if (typeof google !== 'undefined') { - resolve(); - return; - } - const check = setInterval(() => { - if (typeof google !== 'undefined') { - clearInterval(check); - resolve(); - } - }, 50); - }); -} +const googleReady = new Promise((resolve) => { + const script = document.createElement('script'); + script.src = 'https://accounts.google.com/gsi/client'; + script.onload = resolve; + document.head.appendChild(script); +}); export async function auth() { let profile = getProfile(); @@ -48,7 +40,7 @@ export async function auth() { return profile; } - await waitForGoogle(); + await googleReady; const signin = document.getElementById('signin'); signin.style.display = 'block'; diff --git a/static/index.html b/static/index.html index 73109a6..0c8c1d2 100644 --- a/static/index.html +++ b/static/index.html @@ -7,7 +7,6 @@ HCA Tickets -