diff --git a/admin-dashboard.html b/admin-dashboard.html index ca28a5a..162bbeb 100644 --- a/admin-dashboard.html +++ b/admin-dashboard.html @@ -1390,7 +1390,7 @@ function handleImageUpload(event) { } // Hardcoded apps data - should match the ones in index.html -const HARDCODED_APPS = [ +window.HARDCODED_APPS = [ { id: 'hardcoded-car', name: 'Záznam služebních jízd', @@ -1425,54 +1425,40 @@ const HARDCODED_APPS = [ } ]; +console.log("HARDCODED_APPS defined:", window.HARDCODED_APPS); + // Load hardcoded apps -async function loadHardcodedApps() { - const hardcodedAppsList = document.getElementById('hardcodedAppsList'); - +function loadHardcodedApps() { + console.log("Loading hardcoded apps..."); try { - // Get the list of dynamic apps to check for duplicates - const token = localStorage.getItem('token'); - if (!token) { - window.location.href = '/login.html'; + const hardcodedAppsList = document.getElementById('hardcodedAppsList'); + + if (!hardcodedAppsList) { + console.error("hardcodedAppsList element not found"); return; } - const response = await fetch('/api/apps', { - headers: { - 'Authorization': `Bearer ${token}`, - 'Content-Type': 'application/json' - } - }); - - if (!response.ok) { - throw new Error(`HTTP error! status: ${response.status}`); - } - - const dynamicApps = await response.json(); - const dynamicAppIds = new Set(dynamicApps.map(app => app.id)); - - // Filter out hardcoded apps that are already in the dynamic apps list - const uniqueHardcodedApps = HARDCODED_APPS.filter(app => !dynamicAppIds.has(app.id)); - - if (uniqueHardcodedApps.length === 0) { + if (!window.HARDCODED_APPS || !Array.isArray(window.HARDCODED_APPS) || window.HARDCODED_APPS.length === 0) { + console.log("No hardcoded apps found"); hardcodedAppsList.innerHTML = `
${app.url}
-${app.description}
+${app.url || ''}
+ ${app.description ? `${app.description}
` : ''}Žádné vlastní aplikace nebyly nalezeny
-${app.url || ''}
+ ${app.description ? `${app.description}
` : ''}Žádné vlastní aplikace nebyly nalezeny
-+ Chyba při načítání aplikací: ${error.message} +
+