Clean up router index, add route names

This commit is contained in:
Ramon Wenger 2024-11-11 17:03:30 +01:00
parent d361dabd16
commit 20e2a2b172
2 changed files with 254 additions and 223 deletions

View File

@ -14,9 +14,12 @@ import { addToHistory, setLastNavigationWasPush } from "@/router/history";
import { onboardingRedirect } from "@/router/onboarding"; import { onboardingRedirect } from "@/router/onboarding";
import { createRouter, createWebHistory } from "vue-router"; import { createRouter, createWebHistory } from "vue-router";
import { import {
ATTENDANCE_ROUTE,
CERTIFICATES_ROUTE, CERTIFICATES_ROUTE,
COCKPIT_ROUTE,
COMPETENCE_ROUTE, COMPETENCE_ROUTE,
COMPETENCES_ROUTE, COMPETENCES_ROUTE,
DOCUMENTS_ROUTE,
SELF_EVALUATION_ROUTE, SELF_EVALUATION_ROUTE,
SETTINGS_ROUTE, SETTINGS_ROUTE,
} from "./names"; } from "./names";
@ -86,8 +89,11 @@ const router = createRouter({
props: true, props: true,
}, },
{ {
path: "/course/:courseSlug/media", path: "/course/:courseSlug",
props: true, props: true,
children: [
{
path: "media",
component: () => import("@/pages/mediaLibrary/MediaLibraryParentPage.vue"), component: () => import("@/pages/mediaLibrary/MediaLibraryParentPage.vue"),
children: [ children: [
{ {
@ -97,18 +103,19 @@ const router = createRouter({
{ {
path: ":categorySlug", path: ":categorySlug",
props: true, props: true,
component: () => import("@/pages/mediaLibrary/MediaLibraryCategoryPage.vue"), component: () =>
import("@/pages/mediaLibrary/MediaLibraryCategoryPage.vue"),
}, },
{ {
path: ":categorySlug/:contentSlug", path: ":categorySlug/:contentSlug",
props: true, props: true,
component: () => import("@/pages/mediaLibrary/MediaLibraryContentPage.vue"), component: () =>
import("@/pages/mediaLibrary/MediaLibraryContentPage.vue"),
}, },
], ],
}, },
{ {
path: "/course/:courseSlug/competence", path: "competence",
props: true,
component: () => import("@/pages/competence/CompetenceParentPage.vue"), component: () => import("@/pages/competence/CompetenceParentPage.vue"),
children: [ children: [
{ {
@ -141,51 +148,51 @@ const router = createRouter({
path: "competences", path: "competences",
name: COMPETENCES_ROUTE, name: COMPETENCES_ROUTE,
props: true, props: true,
component: () => import("@/pages/competence/ActionCompetenceListPage.vue"), component: () =>
import("@/pages/competence/ActionCompetenceListPage.vue"),
}, },
], ],
}, },
{ {
path: "/course/:courseSlug/learn", path: "learn",
children: [
{
path: "",
component: () => component: () =>
import("../pages/learningPath/learningPathPage/LearningPathPage.vue"), import("../pages/learningPath/learningPathPage/LearningPathPage.vue"),
props: true,
}, },
{ {
path: "/course/:courseSlug/learn/:circleSlug", path: ":circleSlug",
component: () => import("../pages/learningPath/circlePage/CirclePage.vue"),
props: true,
},
{
path: "/course/:courseSlug/learn/:circleSlug/evaluate/:learningUnitSlug",
component: () => component: () =>
import("../pages/learningPath/selfEvaluationPage/SelfEvaluationPage.vue"), import("../pages/learningPath/circlePage/CirclePage.vue"),
props: true, props: true,
}, },
{ {
path: "/course/:courseSlug/learn/:circleSlug/:contentSlug", path: ":circleSlug/evaluate/:learningUnitSlug",
component: () => component: () =>
import("../pages/learningPath/learningContentPage/LearningContentPage.vue"), import(
"../pages/learningPath/selfEvaluationPage/SelfEvaluationPage.vue"
),
props: true, props: true,
}, },
{ {
path: "/lernbegleitung/:courseId/invitation/:invitationId", path: ":circleSlug/:contentSlug",
component: () => import("@/pages/learningMentor/InvitationAcceptPage.vue"), component: () =>
import(
"../pages/learningPath/learningContentPage/LearningContentPage.vue"
),
props: true, props: true,
beforeEnter: handleAcceptLearningMentorInvitation,
meta: {
// The login redirect is handled in the beforeEnter guard
public: true,
}, },
],
}, },
{ {
path: "/course/:courseSlug/profile/:userId", path: "profile/:userId",
component: () => import("@/pages/userProfile/UserProfilePage.vue"), component: () => import("@/pages/userProfile/UserProfilePage.vue"),
props: true,
children: [ children: [
{ {
path: "learning-path", path: "learning-path",
component: () => import("@/pages/userProfile/LearningPathProfilePage.vue"), component: () =>
import("@/pages/userProfile/LearningPathProfilePage.vue"),
props: true, props: true,
name: "profileLearningPath", name: "profileLearningPath",
meta: { meta: {
@ -237,9 +244,8 @@ const router = createRouter({
], ],
}, },
{ {
path: "/course/:courseSlug/learning-mentor", path: "learning-mentor",
component: () => import("@/pages/learningMentor/mentor/MentorIndexPage.vue"), component: () => import("@/pages/learningMentor/mentor/MentorIndexPage.vue"),
props: true,
name: "learningMentor", name: "learningMentor",
children: [ children: [
{ {
@ -269,7 +275,9 @@ const router = createRouter({
{ {
path: "praxis-assignments/:praxisAssignmentId", path: "praxis-assignments/:praxisAssignmentId",
component: () => component: () =>
import("@/pages/learningMentor/mentor/MentorPraxisAssignmentPage.vue"), import(
"@/pages/learningMentor/mentor/MentorPraxisAssignmentPage.vue"
),
name: "learningMentorPraxisAssignments", name: "learningMentorPraxisAssignments",
props: true, props: true,
}, },
@ -287,18 +295,23 @@ const router = createRouter({
], ],
}, },
{ {
path: "/course/:courseSlug/assignment-evaluation/:assignmentId/:userId", path: "assignment-evaluation/:assignmentId/:userId",
component: () => component: () =>
import("@/pages/assignmentEvaluation/AssignmentEvaluationPage.vue"), import("@/pages/assignmentEvaluation/AssignmentEvaluationPage.vue"),
props: true, props: true,
}, },
{ {
path: "/course/:courseSlug/cockpit", path: "cockpit",
name: "cockpit", name: "cockpit",
component: () =>
import("@/pages/cockpit/cockpitPage/CockpitExpertParentPage.vue"),
props: true,
children: [ children: [
{ {
path: "", path: "",
component: () => import("@/pages/cockpit/cockpitPage/CockpitExpertPage.vue"), component: () =>
import("@/pages/cockpit/cockpitPage/CockpitExpertHomePage.vue"),
name: COCKPIT_ROUTE,
props: true, props: true,
}, },
{ {
@ -322,14 +335,29 @@ const router = createRouter({
component: () => component: () =>
import("@/pages/cockpit/attendanceCheckPage/AttendanceCheckPage.vue"), import("@/pages/cockpit/attendanceCheckPage/AttendanceCheckPage.vue"),
props: true, props: true,
name: ATTENDANCE_ROUTE,
}, },
{ {
path: "documents", path: "documents",
component: () => import("@/pages/cockpit/documentPage/DocumentPage.vue"), component: () => import("@/pages/cockpit/documentPage/DocumentPage.vue"),
props: true, props: true,
name: DOCUMENTS_ROUTE,
}, },
], ],
}, },
],
},
{
path: "/lernbegleitung/:courseId/invitation/:invitationId",
component: () => import("@/pages/learningMentor/InvitationAcceptPage.vue"),
props: true,
beforeEnter: handleAcceptLearningMentorInvitation,
meta: {
// The login redirect is handled in the beforeEnter guard
public: true,
},
},
{ {
path: "/statistic/:courseSlug", path: "/statistic/:courseSlug",
props: true, props: true,

View File

@ -3,3 +3,6 @@ export const CERTIFICATES_ROUTE = "certificates";
export const SELF_EVALUATION_ROUTE = "selfEvaluationAndFeedback"; export const SELF_EVALUATION_ROUTE = "selfEvaluationAndFeedback";
export const COMPETENCES_ROUTE = "competences"; export const COMPETENCES_ROUTE = "competences";
export const SETTINGS_ROUTE = "settings"; export const SETTINGS_ROUTE = "settings";
export const COCKPIT_ROUTE = "cockpit-home";
export const ATTENDANCE_ROUTE = "attendance";
export const DOCUMENTS_ROUTE = "documents";