fix: only update daytime salutation when switching to home view
continuous-integration/drone/pr Build is passing Details

This commit is contained in:
kolaente 2023-03-24 19:48:53 +01:00
parent 906646e28a
commit e941077227
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 3 additions and 5 deletions

View File

@ -1,6 +1,5 @@
import {computed} from 'vue'
import {computed, onMounted, ref} from 'vue'
import {useI18n} from 'vue-i18n'
import {useNow} from '@vueuse/core'
import {useAuthStore} from '@/stores/auth'
import {hourToDaytime} from '@/helpers/hourToDaytime'
@ -9,9 +8,8 @@ export type Daytime = 'night' | 'morning' | 'day' | 'evening'
export function useDaytimeSalutation() {
const {t} = useI18n({useScope: 'global'})
const now = useNow({
interval: 30 * 60 * 1000, // Every 30 minutes
})
const now = ref(new Date())
onMounted(() => now.value = new Date())
const authStore = useAuthStore()
const name = computed(() => authStore.userDisplayName)