2023-02-08 12:41:35 -08:00
|
|
|
<script lang="ts">
|
|
|
|
import { VIEWS } from '@/constants';
|
|
|
|
import { mapStores } from 'pinia';
|
2023-05-05 01:41:54 -07:00
|
|
|
import { useUsersStore } from '@/stores/users.store';
|
2023-05-15 09:41:13 -07:00
|
|
|
import { defineComponent } from 'vue';
|
|
|
|
import { useToast } from '@/composables';
|
2023-02-08 12:41:35 -08:00
|
|
|
|
2023-05-15 09:41:13 -07:00
|
|
|
export default defineComponent({
|
2023-02-08 12:41:35 -08:00
|
|
|
name: 'SignoutView',
|
2023-05-15 09:41:13 -07:00
|
|
|
setup() {
|
|
|
|
return {
|
|
|
|
...useToast(),
|
|
|
|
};
|
|
|
|
},
|
2023-02-08 12:41:35 -08:00
|
|
|
computed: {
|
|
|
|
...mapStores(useUsersStore),
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
async logout() {
|
|
|
|
try {
|
|
|
|
await this.usersStore.logout();
|
2023-05-10 08:10:03 -07:00
|
|
|
void this.$router.replace({ name: VIEWS.SIGNIN });
|
2023-02-08 12:41:35 -08:00
|
|
|
} catch (e) {
|
2023-05-15 09:41:13 -07:00
|
|
|
this.showError(e, this.$locale.baseText('auth.signout.error'));
|
2023-02-08 12:41:35 -08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
mounted() {
|
2023-05-10 08:10:03 -07:00
|
|
|
void this.logout();
|
2023-02-08 12:41:35 -08:00
|
|
|
},
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<div />
|
|
|
|
</template>
|