summaryrefslogtreecommitdiff
path: root/src/main.js
diff options
context:
space:
mode:
authorcurly <curly@infernal.garden>2024-07-16 13:36:30 -0600
committercurly <curly@infernal.garden>2024-07-16 13:36:30 -0600
commit339ed00eb7496fc44ec5113b0520838305062039 (patch)
tree30b9a278f3676e3199230bbe8ddf854665c5f480 /src/main.js
parentfb2c8941ef20293d4b9ae964c024f35507939bbd (diff)
downloadpoko_web-339ed00eb7496fc44ec5113b0520838305062039.tar.gz
poko_web-339ed00eb7496fc44ec5113b0520838305062039.tar.bz2
poko_web-339ed00eb7496fc44ec5113b0520838305062039.zip
delete user
Diffstat (limited to 'src/main.js')
-rw-r--r--src/main.js21
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