UNPKG

profoundjs

Version:

Profound.js Framework and Server

18 lines (17 loc) 708 B
<!-- LOGOUT_BAR_CSS --> <div class="pjs-explorer-logout-bar"> <span class="user-label" id="pjs-explorer-user"></span> <button class="logout-btn" id="pjs-explorer-logout-btn">Logout</button> </div> <script> (function() { var btn = document.getElementById("pjs-explorer-logout-btn"); if (!btn) return; btn.addEventListener("click", function() { var baseUrl = document.location.href.replace(document.location.hash, "").replace(document.location.search, ""); fetch(baseUrl + "explorer-logout", { method: "POST", credentials: "same-origin" }) .then(function() { window.location.reload(); }) .catch(function() { window.location.reload(); }); }); })(); </script>