Files
gemory/src/main.ts
T
2026-06-28 22:10:34 +02:00

33 lines
716 B
TypeScript

import {createPinia} from 'pinia';
import {createApp} from 'vue';
import {createRouter, createWebHistory} from 'vue-router';
import App from './App.vue';
import {useAuthStore} from './auth';
import {initLogger} from './logger';
import {routeNames, routes} from './routes';
import './style.css';
initLogger();
const app = createApp(App);
const pinia = createPinia();
const router = createRouter({
history: createWebHistory(),
routes,
});
app.use(pinia);
const authStore = useAuthStore();
await authStore.bootstrap();
router.beforeEach(to => {
if (!to.meta.public && !authStore.isAuthenticated) {
return {name: routeNames.home};
}
return true;
});
app.use(router);
app.mount('#app');