aboutsummaryrefslogtreecommitdiffstats
path: root/web/composables/logout.ts
diff options
context:
space:
mode:
Diffstat (limited to 'web/composables/logout.ts')
-rw-r--r--web/composables/logout.ts15
1 files changed, 15 insertions, 0 deletions
diff --git a/web/composables/logout.ts b/web/composables/logout.ts
new file mode 100644
index 0000000..35b0511
--- /dev/null
+++ b/web/composables/logout.ts
@@ -0,0 +1,15 @@
+export function logout() {
+ const authStore = useAuthStore()
+ const conferenceStore = useConferenceStore()
+ const config = useRuntimeConfig();
+
+ $api(config.public.baseURL + '/logout', { method: 'POST' }).finally(() => {
+ authStore.admin = false;
+ authStore.username = null;
+ authStore.token = null;
+
+ conferenceStore.clear()
+
+ navigateTo({ path: '/login', state: { error: 'You have logged out' } });
+ })
+} \ No newline at end of file