62 lines
1.4 KiB
TypeScript
62 lines
1.4 KiB
TypeScript
import {createApp} from 'vue';
|
|
import {createPinia} from 'pinia';
|
|
|
|
import App from './App.vue';
|
|
|
|
import Keycloak from 'keycloak-js';
|
|
import {useUserStore} from 'stores/user-store';
|
|
import { useChatStore } from 'stores/chat-store';
|
|
import { useNotificationStore } from './stores/notification-store';
|
|
|
|
const app = createApp(App);
|
|
const pinia = createPinia();
|
|
|
|
app.use(pinia);
|
|
|
|
|
|
|
|
const userStore = useUserStore();
|
|
const chatStore = useChatStore();
|
|
let keycloak:Keycloak;
|
|
userStore.initKeycloak().then(r=> {
|
|
keycloak=r;
|
|
|
|
if (keycloak.subject) {
|
|
userStore.id = keycloak.subject;
|
|
userStore.getPtpUserById(keycloak.subject).then(() =>
|
|
userStore.loadPtpUsersById(keycloak.subject||"").then(user => {
|
|
console.log(JSON.stringify(user));
|
|
})
|
|
);
|
|
|
|
const interval = setInterval(() => {
|
|
if(userStore.userLoaded) {
|
|
chatStore.loadProfilePictures();
|
|
userStore.loadProfilePictures();
|
|
clearInterval(interval);
|
|
}
|
|
|
|
userStore.getPtpUserById(keycloak.subject!);
|
|
}, 5000);
|
|
|
|
Notification.requestPermission().then((result) => {
|
|
useNotificationStore().saveDecision(result === "granted");
|
|
});
|
|
|
|
} else {
|
|
console.error("hier ist was schlimmes passiert menno");
|
|
}
|
|
}).catch(e=>console.error(e));
|
|
|
|
|
|
window.onfocus = function() {
|
|
useNotificationStore().isTabActive = true;
|
|
}
|
|
|
|
window.onblur = function() {
|
|
useNotificationStore().isTabActive = false;
|
|
}
|
|
|
|
|
|
|