move to the proper HTTP methods

This commit is contained in:
creations 2025-06-01 08:34:17 -04:00
parent dc904dd0ff
commit 13159e5d78
Signed by: creations
GPG key ID: 8F553AA4320FC711
4 changed files with 20 additions and 16 deletions

View file

@ -52,7 +52,11 @@ async function fetchUserInfo() {
deleteBtn.addEventListener("click", async () => {
try {
const res = await fetch("/delete", { credentials: "include" });
const res = await fetch("/delete", {
method: "DELETE",
credentials: "include"
});
if (!res.ok) throw new Error();
ts.clear();
@ -74,8 +78,11 @@ setBtn.addEventListener("click", async () => {
if (!timezone) return;
try {
const res = await fetch(`/set?timezone=${encodeURIComponent(timezone)}`, {
const res = await fetch("/set", {
method: "POST",
credentials: "include",
headers: { "Content-Type": "application/x-www-form-urlencoded" },
body: `timezone=${encodeURIComponent(timezone)}`
});
if (!res.ok) throw new Error();
statusMsg.textContent = "Timezone updated!";