From b73148706dca9e3248aedc0126f77b9fb4cfbe0f Mon Sep 17 00:00:00 2001 From: SinTan1729 Date: Wed, 9 Nov 2022 17:58:15 -0600 Subject: [PATCH] Confirm before deleting entries --- src/main/resources/public/js/main.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/resources/public/js/main.js b/src/main/resources/public/js/main.js index 136dd15..cfa469d 100644 --- a/src/main/resources/public/js/main.js +++ b/src/main/resources/public/js/main.js @@ -54,9 +54,11 @@ const deleteButton = (shortUrl) => { btn.onclick = e => { e.preventDefault(); - fetch(`/api/${shortUrl}`, { - method: "DELETE" - }).then(_ => refreshData()); + if (confirm("Do you want to delete the entry " + shortUrl + "?")) { + fetch(`/api/${shortUrl}`, { + method: "DELETE" + }).then(_ => refreshData()); + } }; return btn;