AppFlowy-Cloud/admin_frontend/templates/home.html

47 lines
1.3 KiB
HTML

<!doctype html>
<html lang="en">
<body>
<div id="content">
<h1>User Management</h1>
<p>Welcome, {{ email }}</p>
</div>
<div id="menu">
<button id="adminBtn">Admin</button>
<button id="logoutBtn">Logout</button>
</div>
<script>
document
.getElementById("logoutBtn")
.addEventListener("click", function () {
// Remove the cookie by setting its value to an empty string and its expiry date to the past.
fetch("/web-api/logout", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
credentials: 'same-origin',
})
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok' + response.statusText);
}
window.location.href = "/web/login";
})
.catch(error => {
console.error('There was a problem with the fetch operation:', error);
});
});
document
.getElementById("adminBtn")
.addEventListener("click", function () {
// Redirect to the admin page.
window.location.href = "/web/admin";
});
</script>
</body>
</html>