fix: only update daytime salutation when switching to home view
continuous-integration/drone/pr Build is passing
Details
continuous-integration/drone/pr Build is passing
Details
This commit is contained in:
parent
906646e28a
commit
e941077227
|
@ -1,6 +1,5 @@
|
||||||
import {computed} from 'vue'
|
import {computed, onMounted, ref} from 'vue'
|
||||||
import {useI18n} from 'vue-i18n'
|
import {useI18n} from 'vue-i18n'
|
||||||
import {useNow} from '@vueuse/core'
|
|
||||||
|
|
||||||
import {useAuthStore} from '@/stores/auth'
|
import {useAuthStore} from '@/stores/auth'
|
||||||
import {hourToDaytime} from '@/helpers/hourToDaytime'
|
import {hourToDaytime} from '@/helpers/hourToDaytime'
|
||||||
|
@ -9,9 +8,8 @@ export type Daytime = 'night' | 'morning' | 'day' | 'evening'
|
||||||
|
|
||||||
export function useDaytimeSalutation() {
|
export function useDaytimeSalutation() {
|
||||||
const {t} = useI18n({useScope: 'global'})
|
const {t} = useI18n({useScope: 'global'})
|
||||||
const now = useNow({
|
const now = ref(new Date())
|
||||||
interval: 30 * 60 * 1000, // Every 30 minutes
|
onMounted(() => now.value = new Date())
|
||||||
})
|
|
||||||
const authStore = useAuthStore()
|
const authStore = useAuthStore()
|
||||||
|
|
||||||
const name = computed(() => authStore.userDisplayName)
|
const name = computed(() => authStore.userDisplayName)
|
||||||
|
|
Reference in New Issue