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 @@