import {createRouter, createWebHistory} from 'vue-router' import HomeView from '../views/HomeView.vue'; import {redirectToLoginIfRequired, updateLoggedIn} from '@/router/guards'; const loginUrl = '/sso/login/' const router = createRouter({ history: createWebHistory(import.meta.env.BASE_URL), routes: [ { path: '/', name: 'home', component: HomeView, meta: { // no login required -> so `public === true` public: true } }, { path: '/login', component: HomeView, beforeEnter(_to, _from) { window.location.href = loginUrl }, meta: { public: true } }, { path: '/analyse', component: () => import('../views/CircleAnalyseExampleView.vue'), }, { path: '/profile', component: () => import('../views/ProfileView.vue'), }, { path: '/learningpath/:learningPathId', component: () => import('../views/LearningPathOverview.vue'), }, { path: '/learningpath/:learningPathId/circle/:circleId', component: () => import('../views/CircleView.vue'), } ] }) router.beforeEach(updateLoggedIn) router.beforeEach(redirectToLoginIfRequired) export default router