From c15c13fd3883f6a17a152cef4db29fba3d485649 Mon Sep 17 00:00:00 2001 From: Yisroel Baum Date: Mon, 3 Aug 2026 19:46:33 +0300 Subject: [PATCH] add frontend logout --- frontend/website/src/stores/auth.ts | 15 +++++++ frontend/website/src/views/DashboardView.vue | 43 ++++++++++++++++++++ 2 files changed, 58 insertions(+) diff --git a/frontend/website/src/stores/auth.ts b/frontend/website/src/stores/auth.ts index d720f18..fc9eef3 100644 --- a/frontend/website/src/stores/auth.ts +++ b/frontend/website/src/stores/auth.ts @@ -101,6 +101,20 @@ export const useAuthStore = defineStore('auth', () => { } } + async function logout(): Promise { + try { + await fetch(`${API_BASE}/api/logout`, { + method: 'POST', + credentials: 'include', + headers: { + Accept: 'application/json', + }, + }) + } finally { + user.value = null + } + } + return { user, loading, @@ -108,5 +122,6 @@ export const useAuthStore = defineStore('auth', () => { isAuthenticated, fetchMe, login, + logout, } }) diff --git a/frontend/website/src/views/DashboardView.vue b/frontend/website/src/views/DashboardView.vue index 90b1b1d..c61783f 100644 --- a/frontend/website/src/views/DashboardView.vue +++ b/frontend/website/src/views/DashboardView.vue @@ -1,11 +1,23 @@