kaffy
kaffy copied to clipboard
Logout button
How can I add logout button to the dashboard?
Ok so this is definitely sort of a hack, but in case some other poor soul ends up here trying to figure something out.
Assuming that you have an endpoint like /auth/logout which can terminate a session, you can take advantage of Kaffy's Extensions functionality which allows a person to drop some javascript in, such as:
<script>
let navbarDiv = document.querySelector(".navbar-menu-wrapper");
let logoutLink = document.createElement("a");
logoutLink.text="Logout";
logoutLink.href="/auth/logout";
logoutLink.style="position: absolute; top: 10px; right: 10px;";
navbarDiv.appendChild(logoutLink);
</script>