From 339ed00eb7496fc44ec5113b0520838305062039 Mon Sep 17 00:00:00 2001 From: curly Date: Tue, 16 Jul 2024 13:36:30 -0600 Subject: delete user --- src/main.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/main.js') diff --git a/src/main.js b/src/main.js index 1ef06e8..28013cd 100644 --- a/src/main.js +++ b/src/main.js @@ -292,4 +292,25 @@ async function update_form() { } else { alert(req.status + ": " + req.body) } +} + +async function delete_form() { + const id = get_id(); + const session = get_session(); + const is_sure = document.getElementById("is_sure").value; + + if (is_sure == "YES") { + const url = server + "/user/delete" + const body = {"id": id, "session": session} + const req = await xhttp_post(url, body); + + if (req.status == 200) { + del_session() + window.location.href = host + } else { + alert("Could not delete user!") + } + } else { + alert("You have to be sure to delete your user!") + } } \ No newline at end of file -- cgit v1.2.3