<!DOCTYPE html>
<html>
<head>
<script>
async function logout(){
let response = await fetch('/logout', {
method: 'POST',
credentials: 'same-origin',
});
if(response.ok){
window.location.href = '/login.html';
}else{
alert(`${response.status} ${response.statusText}`); }
return false;
}
</script>
</head>
<body>
<button onclick="logout()">Logout</button>
</body>
</html>