[notifications] Load when page gets loaded
This commit is contained in:
parent
fc35e2ecec
commit
f787e314ef
|
@ -135,7 +135,10 @@ export default defineComponent({
|
||||||
const useNative = 'Notification' in window && window.Notification !== undefined;
|
const useNative = 'Notification' in window && window.Notification !== undefined;
|
||||||
const noPermission = ref(!useNative || window.Notification.permission !== 'granted');
|
const noPermission = ref(!useNative || window.Notification.permission !== 'granted');
|
||||||
|
|
||||||
onBeforeMount(() => pollNotification());
|
onBeforeMount(() => {
|
||||||
|
polling.value = window.setInterval(() => pollNotification(), config.pollingInterval);
|
||||||
|
pollNotification();
|
||||||
|
});
|
||||||
onBeforeUnmount(() => window.clearInterval(polling.value));
|
onBeforeUnmount(() => window.clearInterval(polling.value));
|
||||||
|
|
||||||
const leftDrawerOpen = computed({
|
const leftDrawerOpen = computed({
|
||||||
|
@ -170,7 +173,6 @@ export default defineComponent({
|
||||||
}
|
}
|
||||||
|
|
||||||
function pollNotification() {
|
function pollNotification() {
|
||||||
polling.value = window.setInterval(() => {
|
|
||||||
void mainStore
|
void mainStore
|
||||||
.loadNotifications(<FG_Plugin.Flaschengeist>flaschengeist)
|
.loadNotifications(<FG_Plugin.Flaschengeist>flaschengeist)
|
||||||
.then((notifications) => {
|
.then((notifications) => {
|
||||||
|
@ -182,7 +184,6 @@ export default defineComponent({
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}, config.pollingInterval);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Reference in New Issue