Merged in feature/bugfix-cockpit-link (pull request #37)
Fix bug in NavigationGuard Approved-by: Christian Cueni
This commit is contained in:
commit
4267d50309
|
|
@ -34,6 +34,6 @@ describe("Guards", () => {
|
||||||
courseSlug: "test",
|
courseSlug: "test",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
expect(expertRequired(to)).toEqual(to);
|
expect(expertRequired(to)).toBe(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ const loginRequired = (to: RouteLocationNormalized) => {
|
||||||
export const expertRequired: NavigationGuard = (to: RouteLocationNormalized) => {
|
export const expertRequired: NavigationGuard = (to: RouteLocationNormalized) => {
|
||||||
const courseSessionsStore = useCourseSessionsStore();
|
const courseSessionsStore = useCourseSessionsStore();
|
||||||
if (courseSessionsStore.hasCockpit) {
|
if (courseSessionsStore.hasCockpit) {
|
||||||
return to;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
const courseSlug = to.params.courseSlug as string;
|
const courseSlug = to.params.courseSlug as string;
|
||||||
return `/course/${courseSlug}/learn`;
|
return `/course/${courseSlug}/learn`;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue