fix: make inX helpers more robust

-> do really just match /learn and /learn/x not learnXXX
This commit is contained in:
Livio Bieri 2024-03-11 15:07:50 +01:00
parent 2989085a42
commit 77b4f9cfe3
1 changed files with 6 additions and 6 deletions

View File

@ -8,32 +8,32 @@ export function useRouteLookups() {
}
function inCockpit() {
const regex = new RegExp("/course/[^/]+/cockpit");
const regex = new RegExp("/course/[^/]+/cockpit($|/)");
return regex.test(route.path);
}
function inLearningPath() {
const regex = new RegExp("/course/[^/]+/learn");
const regex = new RegExp("/course/[^/]+/learn($|/)");
return regex.test(route.path);
}
function inCompetenceProfile() {
const regex = new RegExp("/course/[^/]+/competence");
const regex = new RegExp("/course/[^/]+/competence($|/)");
return regex.test(route.path);
}
function inLearningMentor() {
const regex = new RegExp("/course/[^/]+/mentor");
const regex = new RegExp("/course/[^/]+/mentor($|/)");
return regex.test(route.path);
}
function inMediaLibrary() {
const regex = new RegExp("/course/[^/]+/media");
const regex = new RegExp("/course/[^/]+/media($|/)");
return regex.test(route.path);
}
function inAppointments() {
const regex = new RegExp("/(?:[^/]+/)?appointments");
const regex = new RegExp("/(?:[^/]+/)?appointments($|/)");
return regex.test(route.path);
}