fixed some bugs so that the Präsentation kein komplettes Desaster wird
This commit is contained in:
67
src/main.ts
67
src/main.ts
@@ -10,6 +10,7 @@ import { useNotificationStore } from './stores/notification-store';
|
||||
|
||||
const app = createApp(App);
|
||||
const pinia = createPinia();
|
||||
|
||||
app.use(pinia);
|
||||
|
||||
|
||||
@@ -17,51 +18,35 @@ app.use(pinia);
|
||||
const userStore = useUserStore();
|
||||
const chatStore = useChatStore();
|
||||
let keycloak:Keycloak;
|
||||
userStore.initKeycloak()
|
||||
.then(r=>
|
||||
{
|
||||
keycloak=r
|
||||
let tries = 1;
|
||||
userStore.initKeycloak().then(r=> {
|
||||
keycloak=r;
|
||||
|
||||
// Anfrage ans Backend
|
||||
if (keycloak.subject) {
|
||||
userStore.id = keycloak.subject;
|
||||
userStore.getPtpUserById(keycloak.subject).then(() =>
|
||||
userStore.loadPtpUsersById(keycloak.subject||"").then(user => {
|
||||
console.log(JSON.stringify(user));
|
||||
})
|
||||
);
|
||||
|
||||
if (keycloak.subject) {
|
||||
const interval = setInterval(() => {
|
||||
if(userStore.userLoaded) {
|
||||
chatStore.loadProfilePictures();
|
||||
userStore.loadProfilePictures();
|
||||
clearInterval(interval);
|
||||
}
|
||||
|
||||
userStore.id = keycloak.subject;
|
||||
userStore.getPtpUserById(keycloak.subject).then(() =>
|
||||
userStore.loadPtpUsersById(keycloak.subject||"").then(user => {
|
||||
console.log(JSON.stringify(user));
|
||||
}));
|
||||
userStore.getPtpUserById(keycloak.subject!);
|
||||
}, 5000);
|
||||
|
||||
|
||||
|
||||
|
||||
const interval = setInterval(() => {
|
||||
if(userStore.userLoaded) clearInterval(interval);
|
||||
|
||||
userStore.getPtpUserById(keycloak.subject!).then(user => {
|
||||
console.log("New attempt: " + JSON.stringify(user));
|
||||
console.warn(userStore.userLoaded);
|
||||
}).catch(() => {
|
||||
console.error("Ein Netzwerkfehler ist aufgetreten " + tries);
|
||||
userStore.reconnectTries = tries;
|
||||
|
||||
tries++;
|
||||
});
|
||||
}, 5000);
|
||||
|
||||
chatStore.loadProfilePictures();
|
||||
userStore.loadProfilePictures();
|
||||
|
||||
Notification.requestPermission().then((result) => {
|
||||
useNotificationStore().saveDecision(result === "granted");
|
||||
});
|
||||
|
||||
|
||||
} else {
|
||||
console.error("hier ist was schlimmes passiert menno");
|
||||
}
|
||||
}).catch(e=>console.error(e));
|
||||
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() {
|
||||
|
||||
Reference in New Issue
Block a user