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';
|
|
|
|
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
|
|
let tries = 1;
|
|
|
|
// 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));
|
|
}));
|
|
|
|
|
|
|
|
|
|
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();
|
|
|
|
} else {
|
|
console.error("hier ist was schlimmes passiert menno");
|
|
}
|
|
}).catch(e=>console.error(e));
|
|
|
|
|
|
|