notification-store now saves wether the applications tab is focussed
This commit is contained in:
15
src/main.ts
15
src/main.ts
@@ -6,6 +6,7 @@ import App from './App.vue';
|
|||||||
import Keycloak from 'keycloak-js';
|
import Keycloak from 'keycloak-js';
|
||||||
import {useUserStore} from 'stores/user-store';
|
import {useUserStore} from 'stores/user-store';
|
||||||
import { useChatStore } from 'stores/chat-store';
|
import { useChatStore } from 'stores/chat-store';
|
||||||
|
import { useNotificationStore } from './stores/notification-store';
|
||||||
|
|
||||||
const app = createApp(App);
|
const app = createApp(App);
|
||||||
const pinia = createPinia();
|
const pinia = createPinia();
|
||||||
@@ -52,10 +53,24 @@ userStore.initKeycloak()
|
|||||||
chatStore.loadProfilePictures();
|
chatStore.loadProfilePictures();
|
||||||
userStore.loadProfilePictures();
|
userStore.loadProfilePictures();
|
||||||
|
|
||||||
|
Notification.requestPermission().then((result) => {
|
||||||
|
useNotificationStore().saveDecision(result === "granted");
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
console.error("hier ist was schlimmes passiert menno");
|
console.error("hier ist was schlimmes passiert menno");
|
||||||
}
|
}
|
||||||
}).catch(e=>console.error(e));
|
}).catch(e=>console.error(e));
|
||||||
|
|
||||||
|
|
||||||
|
window.onfocus = function() {
|
||||||
|
useNotificationStore().isTabActive = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
window.onblur = function() {
|
||||||
|
useNotificationStore().isTabActive = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user