diff options
Diffstat (limited to 'src/main.js')
-rw-r--r-- | src/main.js | 21 |
1 files changed, 21 insertions, 0 deletions
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 |