From 95dd159e8947b584cf0ae7b926e049608ee60ffd Mon Sep 17 00:00:00 2001 From: Debian Date: Wed, 7 Jan 2026 21:54:18 +0000 Subject: [PATCH] Fix Delete button not responding to clicks in gallery Same issue as View Progress button - replace inline onclick handler with proper addEventListener to fix silent failures from async promise rejections. Co-Authored-By: Claude Opus 4.5 --- frontend/public/js/app.js | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/frontend/public/js/app.js b/frontend/public/js/app.js index 927b41d..53d23ff 100644 --- a/frontend/public/js/app.js +++ b/frontend/public/js/app.js @@ -428,23 +428,25 @@ function renderGallery(container, items) { ${formatDate(item.createdAt)} `).join(''); -} -async function deleteContent(id) { - if (!confirm('Are you sure you want to delete this content?')) return; - - try { - await api(`/content/${id}`, { method: 'DELETE' }); - loadGallery(currentPage); - } catch (error) { - alert(error.message); - } + container.querySelectorAll('.delete-content-btn').forEach(btn => { + btn.addEventListener('click', async function() { + const contentId = parseInt(this.dataset.contentId, 10); + if (!confirm('Are you sure you want to delete this content?')) return; + try { + await api(`/content/${contentId}`, { method: 'DELETE' }); + loadGallery(currentPage); + } catch (error) { + alert(error.message); + } + }); + }); } // Admin