Fix delete not working

This commit is contained in:
soruly 2022-06-18 17:28:22 +00:00
parent d1e57c2b7c
commit 658e936dce
No known key found for this signature in database
GPG Key ID: EF971E90F3D2521F
1 changed files with 2 additions and 2 deletions

View File

@ -45,12 +45,12 @@ document.querySelector("form").onsubmit = async (e) => {
for (const e of document.querySelectorAll(".delete")) {
e.addEventListener("click", async (e) => {
if (confirm(`Delete ${e.target.parentElement.id} ?`)) {
if (confirm(`Delete ${e.target.parentElement.parentElement.id} ?`)) {
const res = await fetch("/", {
method: "DELETE",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
name: e.target.parentElement.id,
name: e.target.parentElement.parentElement.id,
}),
});
if (res.status === 204) window.location.reload();