Use correct type
This commit is contained in:
parent
58df3201d4
commit
83d2e99199
|
|
@ -1,8 +1,8 @@
|
||||||
import { useCourseSessionsStore } from "@/stores/courseSessions";
|
import { useCourseSessionsStore } from "@/stores/courseSessions";
|
||||||
import { useUserStore } from "@/stores/user";
|
import { useUserStore } from "@/stores/user";
|
||||||
import type { NavigationGuardWithThis, RouteLocationNormalized } from "vue-router";
|
import type { NavigationGuard, RouteLocationNormalized } from "vue-router";
|
||||||
|
|
||||||
export const updateLoggedIn: NavigationGuardWithThis<undefined> = async () => {
|
export const updateLoggedIn: NavigationGuard = async () => {
|
||||||
const loggedIn = getCookieValue("loginStatus") === "true";
|
const loggedIn = getCookieValue("loginStatus") === "true";
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
|
|
||||||
|
|
@ -12,7 +12,7 @@ export const updateLoggedIn: NavigationGuardWithThis<undefined> = async () => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const redirectToLoginIfRequired: NavigationGuardWithThis<undefined> = (to) => {
|
export const redirectToLoginIfRequired: NavigationGuard = (to) => {
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
if (loginRequired(to) && !userStore.loggedIn) {
|
if (loginRequired(to) && !userStore.loggedIn) {
|
||||||
return `/login?next=${to.fullPath}`;
|
return `/login?next=${to.fullPath}`;
|
||||||
|
|
@ -34,7 +34,7 @@ const loginRequired = (to: RouteLocationNormalized) => {
|
||||||
return !to.meta?.public;
|
return !to.meta?.public;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const expertRequired = (to: RouteLocationNormalized) => {
|
export const expertRequired: NavigationGuard = (to: RouteLocationNormalized) => {
|
||||||
const courseSessionsStore = useCourseSessionsStore();
|
const courseSessionsStore = useCourseSessionsStore();
|
||||||
if (courseSessionsStore.hasCockpit) {
|
if (courseSessionsStore.hasCockpit) {
|
||||||
return to;
|
return to;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue