Merged in feature/bugfix-cockpit-link (pull request #37)

Fix bug in NavigationGuard

Approved-by: Christian Cueni
This commit is contained in:
Daniel Egger 2023-03-09 09:14:03 +00:00 committed by Christian Cueni
commit 4267d50309
2 changed files with 2 additions and 2 deletions

View File

@ -34,6 +34,6 @@ describe("Guards", () => {
courseSlug: "test",
},
};
expect(expertRequired(to)).toEqual(to);
expect(expertRequired(to)).toBe(true);
});
});

View File

@ -37,7 +37,7 @@ const loginRequired = (to: RouteLocationNormalized) => {
export const expertRequired: NavigationGuard = (to: RouteLocationNormalized) => {
const courseSessionsStore = useCourseSessionsStore();
if (courseSessionsStore.hasCockpit) {
return to;
return true;
} else {
const courseSlug = to.params.courseSlug as string;
return `/course/${courseSlug}/learn`;