44 lines
955 B
TypeScript
44 lines
955 B
TypeScript
import { useRoute } from "vue-router";
|
|
|
|
export function useRouteLookups() {
|
|
const route = useRoute();
|
|
|
|
function inCourse() {
|
|
return route.path.startsWith("/course/");
|
|
}
|
|
|
|
function inCockpit() {
|
|
const regex = new RegExp("/course/[^/]+/cockpit");
|
|
return regex.test(route.path);
|
|
}
|
|
|
|
function inLearningPath() {
|
|
const regex = new RegExp("/course/[^/]+/learn");
|
|
return regex.test(route.path);
|
|
}
|
|
|
|
function inCompetenceProfile() {
|
|
const regex = new RegExp("/course/[^/]+/competence");
|
|
return regex.test(route.path);
|
|
}
|
|
|
|
function inMediaLibrary() {
|
|
const regex = new RegExp("/course/[^/]+/media");
|
|
return regex.test(route.path);
|
|
}
|
|
|
|
function inAppointments() {
|
|
const regex = new RegExp("/(?:[^/]+/)?appointments");
|
|
return regex.test(route.path);
|
|
}
|
|
|
|
return {
|
|
inMediaLibrary,
|
|
inCockpit,
|
|
inLearningPath,
|
|
inCompetenceProfile,
|
|
inCourse,
|
|
inAppointments: inAppointments,
|
|
};
|
|
}
|