Formatting + Added Home Page

This commit is contained in:
IM23a-spirgif
2025-04-17 14:21:05 +02:00
parent 2d41fea0f1
commit bf2266af9b
3 changed files with 41 additions and 23 deletions
+20
View File
@@ -16,4 +16,24 @@ document.addEventListener("DOMContentLoaded", async () => {
} catch (error) {
console.log(error);
}
logoutButton.addEventListener("click", async (e) => {
e.preventDefault();
try {
const logoutRes = await fetch('/logout', {
method: "DELETE",
headers: {
"Content-Type": "application/json",
}
});
if (logoutRes.ok) {
document.cookie = "authorization=; Max-Age=0; path=/;";
window.location.href = "/login";
} else {
console.log("Failed to logout");
}
} catch (err) {
console.log("Logout error:", err);
}
});
});