aboutsummaryrefslogtreecommitdiffstats
path: root/web/composables/logout.ts
blob: 35b05110188a50a4c7f5f63ef98851b5063dfed9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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' } });
  })
}