199 lines
5.4 KiB
TypeScript
199 lines
5.4 KiB
TypeScript
import DashboardPage from "@/pages/DashboardPage.vue";
|
|
import LoginPage from "@/pages/LoginPage.vue";
|
|
import {
|
|
handleCourseSessions,
|
|
redirectToLoginIfRequired,
|
|
updateLoggedIn,
|
|
} from "@/router/guards";
|
|
import { createRouter, createWebHistory } from "vue-router";
|
|
|
|
const router = createRouter({
|
|
history: createWebHistory(import.meta.env.BASE_URL),
|
|
scrollBehavior(to, from, savedPosition) {
|
|
if (savedPosition) {
|
|
return savedPosition;
|
|
} else {
|
|
return { top: 0 };
|
|
}
|
|
},
|
|
routes: [
|
|
{
|
|
path: "/login",
|
|
component: LoginPage,
|
|
props: { loginMethod: "sso" },
|
|
meta: {
|
|
// no login required -> so `public === true`
|
|
public: true,
|
|
},
|
|
},
|
|
{
|
|
path: "/login-local",
|
|
component: LoginPage,
|
|
props: { loginMethod: "local" },
|
|
meta: {
|
|
// no login required -> so `public === true`
|
|
public: true,
|
|
},
|
|
},
|
|
{
|
|
path: "/",
|
|
name: "home",
|
|
component: DashboardPage,
|
|
},
|
|
{
|
|
path: "/course/:courseSlug/media",
|
|
props: true,
|
|
component: () => import("@/pages/mediaLibrary/MediaLibraryParentPage.vue"),
|
|
children: [
|
|
{
|
|
path: "",
|
|
component: () => import("@/pages/mediaLibrary/MediaLibraryIndexPage.vue"),
|
|
},
|
|
{
|
|
path: ":categorySlug",
|
|
props: true,
|
|
component: () => import("@/pages/mediaLibrary/MediaLibraryCategoryPage.vue"),
|
|
},
|
|
{
|
|
path: ":categorySlug/:contentSlug",
|
|
props: true,
|
|
component: () => import("@/pages/mediaLibrary/MediaLibraryContentPage.vue"),
|
|
},
|
|
],
|
|
},
|
|
{
|
|
path: "/course/:courseSlug/competence-old",
|
|
props: true,
|
|
component: () => import("@/pages/competence-old/CompetenceParentPage.vue"),
|
|
children: [
|
|
{
|
|
path: "",
|
|
props: true,
|
|
component: () => import("@/pages/competence-old/CompetenceIndexPage.vue"),
|
|
},
|
|
{
|
|
path: "competences",
|
|
props: true,
|
|
component: () => import("@/pages/competence-old/CompetenceListPage.vue"),
|
|
},
|
|
{
|
|
path: "criteria",
|
|
props: true,
|
|
component: () => import("@/pages/competence-old/PerformanceCriteriaPage.vue"),
|
|
},
|
|
{
|
|
path: "criteria/:criteriaSlug",
|
|
props: true,
|
|
component: () =>
|
|
import("@/pages/competence-old/SinglePerformanceCriteriaPage.vue"),
|
|
},
|
|
],
|
|
},
|
|
{
|
|
path: "/course/:courseSlug/learn",
|
|
component: () =>
|
|
import("../pages/learningPath/learningPathPage/LearningPathPage.vue"),
|
|
props: true,
|
|
},
|
|
{
|
|
path: "/course/:courseSlug/learn/:circleSlug",
|
|
component: () => import("../pages/learningPath/circlePage/CirclePage.vue"),
|
|
props: true,
|
|
},
|
|
{
|
|
path: "/course/:courseSlug/learn/:circleSlug/evaluate/:learningUnitSlug",
|
|
component: () =>
|
|
import("../pages/learningPath/selfEvaluationPage/SelfEvaluationPage.vue"),
|
|
props: true,
|
|
},
|
|
{
|
|
path: "/course/:courseSlug/learn/:circleSlug/:contentSlug",
|
|
component: () =>
|
|
import("../pages/learningPath/learningContentPage/LearningContentPage.vue"),
|
|
props: true,
|
|
},
|
|
{
|
|
path: "/course/:courseSlug/cockpit",
|
|
props: true,
|
|
component: () => import("@/pages/cockpit/CockpitParentPage.vue"),
|
|
children: [
|
|
{
|
|
path: "",
|
|
component: () => import("@/pages/cockpit/cockpitPage/CockpitPage.vue"),
|
|
props: true,
|
|
},
|
|
{
|
|
path: "profile/:userId",
|
|
component: () => import("@/pages/cockpit/CockpitUserProfilePage.vue"),
|
|
props: true,
|
|
},
|
|
{
|
|
path: "profile/:userId/:circleSlug",
|
|
component: () => import("@/pages/cockpit/CockpitUserCirclePage.vue"),
|
|
props: true,
|
|
},
|
|
{
|
|
path: "feedback/:circleId",
|
|
component: () => import("@/pages/cockpit/FeedbackPage.vue"),
|
|
props: true,
|
|
},
|
|
{
|
|
path: "assignment/:assignmentId",
|
|
component: () =>
|
|
import("@/pages/cockpit/assignmentsPage/AssignmentsPage.vue"),
|
|
props: true,
|
|
},
|
|
{
|
|
path: "assignment/:assignmentId/:userId",
|
|
component: () =>
|
|
import(
|
|
"@/pages/cockpit/assignmentEvaluationPage/AssignmentEvaluationPage.vue"
|
|
),
|
|
props: true,
|
|
},
|
|
{
|
|
path: "attendance",
|
|
component: () =>
|
|
import("@/pages/cockpit/attendanceCheckPage/AttendanceCheckPage.vue"),
|
|
props: true,
|
|
},
|
|
],
|
|
},
|
|
{
|
|
path: "/shop",
|
|
component: () => import("@/pages/ShopPage.vue"),
|
|
},
|
|
{
|
|
path: "/messages",
|
|
component: () => import("@/pages/MessagesPage.vue"),
|
|
},
|
|
{
|
|
path: "/settings",
|
|
component: () => import("@/pages/SettingsPage.vue"),
|
|
},
|
|
{
|
|
path: "/notifications",
|
|
component: () => import("@/pages/NotificationsPage.vue"),
|
|
},
|
|
{
|
|
path: "/styleguide",
|
|
component: () => import("../pages/StyleGuidePage.vue"),
|
|
meta: {
|
|
public: true,
|
|
},
|
|
},
|
|
{
|
|
path: "/:pathMatch(.*)*",
|
|
component: () => import("../pages/404Page.vue"),
|
|
},
|
|
],
|
|
});
|
|
|
|
router.beforeEach(updateLoggedIn);
|
|
router.beforeEach(redirectToLoginIfRequired);
|
|
|
|
// register after login hooks
|
|
router.beforeEach(handleCourseSessions);
|
|
|
|
export default router;
|