Added logout button

This commit is contained in:
2023-10-25 01:31:12 +03:00
parent 0baac602e4
commit 20dd0f34bf

View File

@@ -1,7 +1,7 @@
<script> <script>
import { onMount } from 'svelte'; import { onMount } from 'svelte';
import axios from 'axios'; import axios from 'axios';
import { getCookie } from "svelte-cookie"; import {deleteCookie, getCookie} from "svelte-cookie";
let username; let username;
@@ -63,6 +63,11 @@
<div id="profileSpace"> <div id="profileSpace">
<div id="profileInfo">Hello, {username}</div> <div id="profileInfo">Hello, {username}</div>
<button id="logout" on:click={() => {
deleteCookie('access_token');
deleteCookie('refresh_token');
window.location.href = '/auth/login';
}}>Log out</button>
</div> </div>
</div> </div>