From 9b87ecd140ba50f8422fdcaf339467218e982ad3 Mon Sep 17 00:00:00 2001 From: Tomas Dvorak Date: Fri, 30 May 2025 13:56:11 +0200 Subject: [PATCH] d --- admin-dashboard.html | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/admin-dashboard.html b/admin-dashboard.html index 2f1a624..93e8381 100644 --- a/admin-dashboard.html +++ b/admin-dashboard.html @@ -1070,10 +1070,13 @@
-
- +
+
- + +
+
+
@@ -2609,15 +2612,13 @@ async function saveApp(event) { // Get form data const formData = new FormData(document.getElementById('appForm')); - // Add icon class to form data - const iconClass = document.getElementById('appIcon').value; - if (iconClass) { - formData.append('iconClass', iconClass); - } - // Get app ID const appId = document.getElementById('appId').value; + // Get icon class from the selected icon + const iconClass = document.getElementById('appIcon').value; + formData.append('iconClass', iconClass); + // Create request URL const url = appId ? `/api/apps/${appId}` : '/api/apps'; @@ -2628,29 +2629,22 @@ async function saveApp(event) { fetch(url, { method: method, body: formData, - credentials: 'include', - headers: { - 'Content-Type': 'multipart/form-data' - } + credentials: 'include' }) .then(response => { if (!response.ok) { - // Try to get error message if available - return response.json().catch(() => ({ message: 'Nastala chyba při ukládání aplikace' })); + throw new Error('Network response was not ok'); } return response.json(); }) .then(data => { - if (data.message) { - throw new Error(data.message); - } showNotification('Aplikace byla úspěšně uložena', 'success'); loadApps(); closeAppModal(); }) .catch(error => { console.error('Error:', error); - showNotification(error.message || 'Chyba při ukládání aplikace', 'error'); + showNotification('Chyba při ukládání aplikace', 'error'); }); }