Fix some linting errors and warnings
This commit is contained in:
parent
f58b2f6303
commit
a4a93a2214
|
|
@ -7,7 +7,7 @@ import type { LearningPath } from "@/services/learningPath";
|
||||||
import { useCockpitStore } from "@/stores/cockpit";
|
import { useCockpitStore } from "@/stores/cockpit";
|
||||||
import { useCompetenceStore } from "@/stores/competence";
|
import { useCompetenceStore } from "@/stores/competence";
|
||||||
import { useLearningPathStore } from "@/stores/learningPath";
|
import { useLearningPathStore } from "@/stores/learningPath";
|
||||||
import * as log from "loglevel";
|
import log from "loglevel";
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
courseSlug: string;
|
courseSlug: string;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import { useUserStore } from "@/stores/user";
|
import { useUserStore } from "@/stores/user";
|
||||||
import type { NavigationGuardWithThis, RouteLocationNormalized } from "vue-router";
|
import type { NavigationGuardWithThis, RouteLocationNormalized } from "vue-router";
|
||||||
|
|
||||||
export const updateLoggedIn: NavigationGuardWithThis<undefined> = async (_to) => {
|
export const updateLoggedIn: NavigationGuardWithThis<undefined> = async () => {
|
||||||
const loggedIn = getCookieValue("loginStatus") === "true";
|
const loggedIn = getCookieValue("loginStatus") === "true";
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
|
|
||||||
|
|
@ -11,10 +11,7 @@ export const updateLoggedIn: NavigationGuardWithThis<undefined> = async (_to) =>
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const redirectToLoginIfRequired: NavigationGuardWithThis<undefined> = (
|
export const redirectToLoginIfRequired: NavigationGuardWithThis<undefined> = (to) => {
|
||||||
to,
|
|
||||||
_from
|
|
||||||
) => {
|
|
||||||
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}`;
|
||||||
|
|
|
||||||
|
|
@ -154,7 +154,7 @@ const router = createRouter({
|
||||||
router.beforeEach(updateLoggedIn);
|
router.beforeEach(updateLoggedIn);
|
||||||
router.beforeEach(redirectToLoginIfRequired);
|
router.beforeEach(redirectToLoginIfRequired);
|
||||||
|
|
||||||
router.afterEach((to, from) => {
|
router.afterEach(() => {
|
||||||
const appStore = useAppStore();
|
const appStore = useAppStore();
|
||||||
appStore.routingFinished = true;
|
appStore.routingFinished = true;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { itGetCached } from "@/fetchHelpers";
|
import { itGetCached } from "@/fetchHelpers";
|
||||||
import type { CircleExpert, Course, CourseSession } from "@/types";
|
import type { CourseSession } from "@/types";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import log from "loglevel";
|
import log from "loglevel";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ export const useUserStore = defineStore({
|
||||||
handleLogout() {
|
handleLogout() {
|
||||||
Object.assign(this, initialUserState);
|
Object.assign(this, initialUserState);
|
||||||
|
|
||||||
itPost("/api/core/logout/", {}).then((data) => {
|
itPost("/api/core/logout/", {}).then(() => {
|
||||||
let redirectUrl;
|
let redirectUrl;
|
||||||
|
|
||||||
if (logoutRedirectUrl !== "") {
|
if (logoutRedirectUrl !== "") {
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
export function assertUnreachable(x: never): never {
|
export function assertUnreachable(): never {
|
||||||
throw new Error("Didn't expect to get here");
|
throw new Error("Didn't expect to get here");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue