chore: fix bug where entries were not saved, implemented deplete function

This commit is contained in:
2025-06-07 10:05:16 +02:00
parent aa5cc287f0
commit 89ba33378f
2 changed files with 16 additions and 13 deletions

View File

@@ -56,7 +56,7 @@
<p>{{ request.title }}</p>
<div class="actions">
<button onclick="showInfo({{ request | tojson | safe }})" class="info">Info</button>
<button onclick="deleteEntry({{ request.id }})" class="delete-button">Delete</button>
<button onclick="deleteEntry('{{ request.title | escape }}')" class="delete-button">Delete</button>
</div>
</div>
{% endfor %}
@@ -111,10 +111,11 @@
closeModal();
}
}
function deleteEntry(entryId) {
function deleteEntry(title) {
console.log("Deleting entry with title:", title);
fetch(`/delete`, {
method: 'POST',
body: JSON.stringify({ item: entryId }),
body: JSON.stringify({ title: title }), // Send title as part of a JSON object
headers: {
'Content-Type': 'application/json'
}