mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
Merge pull request #240 from appwrite/feat-dropdown-logout
feat: add logout btn to dropdown
This commit is contained in:
@@ -20,6 +20,8 @@
|
||||
import { slide } from 'svelte/transition';
|
||||
import { page } from '$app/stores';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { sdkForConsole } from '$lib/stores/sdk';
|
||||
import { goto } from '$app/navigation';
|
||||
|
||||
let showDropdown = false;
|
||||
let droplistElement: HTMLDivElement;
|
||||
@@ -32,6 +34,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
async function logout() {
|
||||
await sdkForConsole.account.deleteSession('current');
|
||||
trackEvent('submit_account_logout');
|
||||
await goto(`${base}/login`);
|
||||
}
|
||||
|
||||
function onBlur(event: MouseEvent) {
|
||||
if (
|
||||
showDropdown &&
|
||||
@@ -134,6 +142,14 @@
|
||||
on:click={() => (showDropdown = false)}>
|
||||
Your Account
|
||||
</DropListLink>
|
||||
<DropListItem
|
||||
icon="logout-right"
|
||||
on:click={() => {
|
||||
showDropdown = false;
|
||||
logout();
|
||||
}}>
|
||||
Sign Out
|
||||
</DropListItem>
|
||||
</ul>
|
||||
</section>
|
||||
<section class="drop-section">
|
||||
|
||||
Reference in New Issue
Block a user