fix: login sessions

This commit is contained in:
Andy Burke 2025-07-04 14:51:49 -07:00
parent dc91d0ab8c
commit cf46450f5f
11 changed files with 179 additions and 27 deletions

View file

@ -53,5 +53,24 @@
<div class="username-container">
<span class="username" data-bind-user_username></span>
</div>
<form data-smart="true" action="/api/auth" method="DELETE">
<script>
{
const form = document.currentScript.closest("form");
form.on_response = (response) => {
if (!response.ok) {
alert("error logging out!");
return;
}
delete document.body.dataset.user;
delete document.body.dataset.perms;
window.location = "/";
};
}
</script>
<button class="primary">Log Out</button>
</form>
</div>
</div>