diff --git a/admin-dashboard.html b/admin-dashboard.html
index 14e0117..2f1a624 100644
--- a/admin-dashboard.html
+++ b/admin-dashboard.html
@@ -1070,17 +1070,10 @@
-
@@ -2622,12 +2615,6 @@ async function saveApp(event) {
formData.append('iconClass', iconClass);
}
- // Add icon file if selected
- const iconFile = document.getElementById('customIconInput').files[0];
- if (iconFile) {
- formData.append('icon', iconFile);
- }
-
// Get app ID
const appId = document.getElementById('appId').value;
@@ -2641,22 +2628,29 @@ async function saveApp(event) {
fetch(url, {
method: method,
body: formData,
- credentials: 'include'
+ credentials: 'include',
+ headers: {
+ 'Content-Type': 'multipart/form-data'
+ }
})
.then(response => {
if (!response.ok) {
- throw new Error('Network response was not ok');
+ // Try to get error message if available
+ return response.json().catch(() => ({ message: 'Nastala chyba při ukládání aplikace' }));
}
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('Chyba při ukládání aplikace', 'error');
+ showNotification(error.message || 'Chyba při ukládání aplikace', 'error');
});
}