From 069e4d5a3bb03d4fcba46ae40657eb55b8581c53 Mon Sep 17 00:00:00 2001
From: LarsVomMars
Date: Sat, 3 Oct 2020 12:59:22 +0200
Subject: Delte owner
---
quotes/public/script.js | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
(limited to 'quotes/public/script.js')
diff --git a/quotes/public/script.js b/quotes/public/script.js
index 20587fe..8132019 100644
--- a/quotes/public/script.js
+++ b/quotes/public/script.js
@@ -21,10 +21,11 @@ function appendQuote(response) {
"beforeend",
`
${elem["name"]} ${elem["middlename"] ? elem["middlename"] : " "}${elem["surname"]}: ${
elem["quote"]
- } [Löschen]`,
+ }${elem["owner"] ? '[Löschen]' : ""}`,
);
- document.querySelector(`li span[data-id="${elem["id"]}"]`).addEventListener("click", (event) => {
+ const span = document.querySelector(`li span[data-id="${elem["id"]}"]`);
+ if (span) span.addEventListener("click", (event) => {
fetch("api/delete/" + event.target.getAttribute("data-id"), { method: "DELETE" })
.then((response) => response.text())
.then((response) => {
--
cgit v1.2.3