Line data Source code
1 : <template>
2 2103 : <SidebarIcon
3 : icon="icon-[lucide--log-out] scale-90"
4 : :tooltip="tooltip"
5 : :label="$t('sideToolbar.logout')"
6 : @click="logout"
7 : />
8 : </template>
9 :
10 : <script setup lang="ts">
11 : import { computed } from 'vue'
12 : import { useI18n } from 'vue-i18n'
13 :
14 : import { useUserStore } from '@/stores/userStore'
15 :
16 : import SidebarIcon from './SidebarIcon.vue'
17 :
18 2093 : const { t } = useI18n()
19 2093 : const userStore = useUserStore()
20 :
21 2093 : const tooltip = computed(
22 : () => `${t('sideToolbar.logout')} (${userStore.currentUser?.username})`
23 : )
24 2093 : const logout = async () => {
25 0 : await userStore.logout()
26 0 : window.location.reload()
27 : }
28 : </script>
|