diff --git a/.DS_Store b/.DS_Store index a7efda6..f3d46a1 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/public/client.js b/public/client.js index 65704c6..12c6a1b 100644 --- a/public/client.js +++ b/public/client.js @@ -1,8 +1,6 @@ export async function postData(url, data, token = null) { const elements = url.split("/"); - console.log(elements); const end = elements[elements.length - 1]; - console.log(end); const res = await fetch(end, token == null ? { method: "POST", diff --git a/public/delete.js b/public/delete.js new file mode 100644 index 0000000..53b2850 --- /dev/null +++ b/public/delete.js @@ -0,0 +1,9 @@ +import { postData } from "./client.js"; + +document.getElementById("deleteButton").onclick = async e => { + e.preventDefault(); + const resultObject = await postData("/delete", { username: true, actor: true }, window.localStorage.getItem("token")); + window.localStorage.removeItem("token"); + alert(resultObject.message); + window.location.href = "/login.html" +}; diff --git a/public/home.html b/public/home.html index 1e0a279..e9be5df 100644 --- a/public/home.html +++ b/public/home.html @@ -7,20 +7,16 @@