fix: only update daytime salutation when switching to home view
This commit is contained in:
parent
078d8b39a9
commit
c5776264c0
@ -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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user