Add login timeout mechanism and fix premature API calls

- Add 60-second timeout to login initialization in LoginView
- Show retry/offline options when login times out
- Move loadFavorites() to handleLoginSuccess to prevent API calls
  before authentication is complete
- Prevents errors when auto-login is slow or stuck
This commit is contained in:
vicrodh committed 2026-01-16 06:49:03 -06:00
1 parent 688d798b9d
commit 825534621a
2 files changed
+109 -6

No files matched your search

+5 -2
View File
@@ -1266,6 +1266,9 @@
setLoggedIn(info);
showToast(`Welcome, ${info.userName}!`, 'success');
// Load favorites now that login is confirmed
loadFavorites();
// Refresh offline status now that we're logged in
await refreshOfflineStatus();
@@ -1569,8 +1572,8 @@
initDownloadStates();
startDownloadEventListeners();
// Load favorites for global state
loadFavorites();
// Note: loadFavorites() is called in handleLoginSuccess after login is confirmed
// This prevents API calls before authentication is complete
// Subscribe to download state changes to trigger reactivity
const unsubscribeDownloads = subscribeDownloads(() => {