Decouple i18n from feature modules and fix auth/login UX
Replace hardcoded updateAllText() calls with languageChanged event pattern so feature modules subscribe independently. Guard all API calls behind apiKey checks to prevent unauthorized requests when not logged in. Fix login modal localization, hide tabs when logged out, clear all panels on logout, and treat profiles with no conditions as always-true. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -10,12 +10,13 @@ export function switchTab(name) {
|
||||
localStorage.setItem('activeTab', name);
|
||||
if (name === 'dashboard') {
|
||||
// Use window.* to avoid circular imports with feature modules
|
||||
if (typeof window.loadDashboard === 'function') window.loadDashboard();
|
||||
if (typeof window.startDashboardWS === 'function') window.startDashboardWS();
|
||||
if (apiKey && typeof window.loadDashboard === 'function') window.loadDashboard();
|
||||
if (apiKey && typeof window.startDashboardWS === 'function') window.startDashboardWS();
|
||||
} else {
|
||||
if (typeof window.stopDashboardWS === 'function') window.stopDashboardWS();
|
||||
if (typeof window.stopPerfPolling === 'function') window.stopPerfPolling();
|
||||
if (typeof window.stopUptimeTimer === 'function') window.stopUptimeTimer();
|
||||
if (!apiKey) return;
|
||||
if (name === 'streams') {
|
||||
if (typeof window.loadPictureSources === 'function') window.loadPictureSources();
|
||||
} else if (name === 'targets') {
|
||||
|
||||
Reference in New Issue
Block a user