mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender.git
synced 2025-08-04 02:39:14 +02:00
89 lines
2.3 KiB
TypeScript
89 lines
2.3 KiB
TypeScript
import { createRouter, createWebHistory } from "vue-router";
|
|
|
|
const Faq = () => import("../components/FaqPage.vue");
|
|
const AdditionalModules = () => import("../view/AdditionalModules.vue");
|
|
const CalendarLink = () => import("../components/CalendarLink.vue");
|
|
const Imprint = () => import("../view/ImprintPage.vue");
|
|
const PrivacyPolicy = () => import("../view/PrivacyPolicy.vue");
|
|
const RenameModules = () => import("../components/RenameModules.vue");
|
|
const RoomFinder = () => import("../view/RoomFinder.vue");
|
|
const EditCalendarView = () => import("../view/EditCalendarView.vue");
|
|
const EditAdditionalModules = () => import("../components/editCalendar/EditAdditionalModules.vue");
|
|
const EditModules = () => import("../components/editCalendar/EditModules.vue");
|
|
const CourseSelection = () => import("../view/CourseSelection.vue");
|
|
|
|
import i18n from "../i18n";
|
|
|
|
const router = createRouter({
|
|
history: createWebHistory(import.meta.env.BASE_URL),
|
|
routes: [
|
|
{
|
|
path: "/",
|
|
name: "course-selection",
|
|
component: CourseSelection,
|
|
},
|
|
{
|
|
path: "/rooms",
|
|
name: "room-finder",
|
|
component: RoomFinder,
|
|
},
|
|
{
|
|
path: "/faq",
|
|
name: "faq",
|
|
component: Faq,
|
|
},
|
|
{
|
|
path: "/additional-modules",
|
|
name: "additional-modules",
|
|
component: AdditionalModules,
|
|
},
|
|
{
|
|
path: "/edit-additional-modules",
|
|
name: "edit-additional-modules",
|
|
component: EditAdditionalModules,
|
|
},
|
|
{
|
|
path: "/edit-calendar",
|
|
name: "edit-calendar",
|
|
component: EditModules,
|
|
},
|
|
{
|
|
path: "/calendar-link",
|
|
name: "calendar-link",
|
|
component: CalendarLink,
|
|
},
|
|
{
|
|
path: "/edit",
|
|
name: "edit",
|
|
component: EditCalendarView,
|
|
},
|
|
{
|
|
path: "/privacy-policy",
|
|
name: "privacy-policy",
|
|
component: PrivacyPolicy,
|
|
},
|
|
{
|
|
path: "/imprint",
|
|
name: "imprint",
|
|
component: Imprint,
|
|
},
|
|
{
|
|
path: "/rename-modules",
|
|
name: "rename-modules",
|
|
component: RenameModules,
|
|
},
|
|
],
|
|
});
|
|
|
|
router.beforeEach(async (to, from) => {
|
|
const newLocale = to.params.locale;
|
|
const prevLocale = from.params.locale;
|
|
// If the locale hasn't changed, do nothing
|
|
if (newLocale === prevLocale) {
|
|
return;
|
|
}
|
|
i18n.setLocale(newLocale);
|
|
});
|
|
|
|
export default router;
|