32 lines
925 B
TypeScript
32 lines
925 B
TypeScript
import { createApp } from "vue";
|
|
import App from "./App.vue";
|
|
import router from "./router/router.ts";
|
|
import { createPinia } from "pinia";
|
|
import piniaPluginPersistedstate from "pinia-plugin-persistedstate";
|
|
import keycloakService from "./services/keycloak";
|
|
import { type AuthStore, useAuthStore } from "@/stores/authStore.ts";
|
|
|
|
let store: AuthStore;
|
|
|
|
keycloakService.CallInit(() => {
|
|
try {
|
|
const app = createApp(App);
|
|
|
|
// Setup pinia store, allowing user to keep logged in status after refresh
|
|
const pinia = createPinia();
|
|
pinia.use(piniaPluginPersistedstate);
|
|
app.use(pinia);
|
|
store = useAuthStore();
|
|
keycloakService.CallInitStore(store);
|
|
app.use(router);
|
|
|
|
app.mount("#app");
|
|
} catch (e) {
|
|
console.error("Error while initiating Keycloak.");
|
|
console.error(e);
|
|
createApp(App).mount("#app");
|
|
}
|
|
});
|
|
|
|
export { store };
|