2024-09-10 07:23:57 -07:00
|
|
|
<script setup lang="ts">
|
2023-02-08 12:41:35 -08:00
|
|
|
import { VIEWS } from '@/constants';
|
2023-05-05 01:41:54 -07:00
|
|
|
import { useUsersStore } from '@/stores/users.store';
|
2023-11-28 03:15:08 -08:00
|
|
|
import { useToast } from '@/composables/useToast';
|
2024-09-10 07:23:57 -07:00
|
|
|
import { useRouter } from 'vue-router';
|
|
|
|
import { useI18n } from '@/composables/useI18n';
|
|
|
|
import { onMounted } from 'vue';
|
2023-02-08 12:41:35 -08:00
|
|
|
|
2024-09-10 07:23:57 -07:00
|
|
|
const usersStore = useUsersStore();
|
|
|
|
const toast = useToast();
|
|
|
|
const router = useRouter();
|
|
|
|
const i18n = useI18n();
|
|
|
|
|
|
|
|
const logout = async () => {
|
|
|
|
try {
|
|
|
|
await usersStore.logout();
|
|
|
|
window.location.href = router.resolve({ name: VIEWS.SIGNIN }).href;
|
|
|
|
} catch (e) {
|
|
|
|
toast.showError(e, i18n.baseText('auth.signout.error'));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
void logout();
|
2023-02-08 12:41:35 -08:00
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<div />
|
|
|
|
</template>
|