From 393cb3f1e00c8182386d2b9d06e04d9c68a434f7 Mon Sep 17 00:00:00 2001 From: Daniel Onyejesi Date: Sun, 22 Mar 2026 00:31:49 -0400 Subject: [PATCH] Fix: hide auth screen immediately on load if token exists, preventing login flash --- docker-compose.yml | 2 +- public/js/auth.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 092468b..13d5177 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,6 @@ services: pediatric-scribe: - image: danielonyejesi/pediatric-ai-scribe-v3:v1.3 + image: danielonyejesi/pediatric-ai-scribe-v3:v1.4 ports: - "3552:3000" env_file: diff --git a/public/js/auth.js b/public/js/auth.js index 85326bf..ae4ae27 100644 --- a/public/js/auth.js +++ b/public/js/auth.js @@ -27,7 +27,8 @@ document.addEventListener('DOMContentLoaded', function() { // Check for saved session var savedToken = localStorage.getItem(TOKEN_KEY); if (savedToken) { - console.log('[Auth] Found saved token, verifying...'); + // Hide auth screen immediately to prevent flash while verifying token + authScreen.classList.add('hidden'); fetch('/api/auth/me', { headers: { 'Authorization': 'Bearer ' + savedToken } }) @@ -37,15 +38,14 @@ document.addEventListener('DOMContentLoaded', function() { }) .then(function(data) { if (data && data.user) { - console.log('[Auth] Token valid, logging in as:', data.user.email); enterApp(data.user, savedToken); } else { - console.log('[Auth] Token invalid'); + authScreen.classList.remove('hidden'); clearSession(); } }) .catch(function() { - console.log('[Auth] Token expired or invalid'); + authScreen.classList.remove('hidden'); clearSession(); }); }