Proper logout button

This commit is contained in:
2023-10-25 01:39:15 +03:00
parent 20dd0f34bf
commit a583f4b765

View File

@@ -63,12 +63,25 @@
<div id="profileSpace">
<div id="profileInfo">Hello, {username}</div>
<button id="logout" on:click={() => {
<div id="logout" role="button"
tabindex="0"
on:click={() => {
deleteCookie('access_token');
deleteCookie('refresh_token');
window.location.href = '/auth/login';
}}>Log out</button>
}}
on:keydown={e => {
if (e.key === 'Enter' || e.key === ' ') {
deleteCookie('access_token');
deleteCookie('refresh_token');
window.location.href = '/auth/login';
}
}}
>
Log out
</div>
</div>
</div>
<style>
@@ -117,6 +130,7 @@
#profileSpace {
margin-bottom: 20px;
display: flex;
flex-direction: row;
justify-content: center;
color:white;
font-weight: 900;