delete is working

This commit is contained in:
C4illin 2024-05-18 01:41:35 +02:00
parent c2f36e9723
commit 0f0bc6c4e5
3 changed files with 90 additions and 25 deletions

View file

@ -31,13 +31,16 @@ fileInput.addEventListener("change", (e) => {
// Add a onclick for the delete button
const deleteRow = (target) => {
const fileName = target.parentElement.parentElement.children[0].textContent;
const filename = target.parentElement.parentElement.children[0].textContent;
const row = target.parentElement.parentElement;
row.remove();
fetch("/delete", {
method: "POST",
body: JSON.stringify({ fileName }),
body: JSON.stringify({ filename: filename }),
headers: {
"Content-Type": "application/json",
},
})
.then((res) => res.json())
.then((data) => {