fix: login sessions
This commit is contained in:
parent
dc91d0ab8c
commit
cf46450f5f
11 changed files with 179 additions and 27 deletions
|
@ -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>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue