Merge branch 'master' into feature/component

This commit is contained in:
Christian Cueni 2022-05-05 07:17:27 +02:00
commit 35647cc533
1 changed files with 4 additions and 3 deletions

View File

@ -1,5 +1,6 @@
import type {NavigationGuardWithThis, RouteLocationNormalized} from 'vue-router'; import type {NavigationGuardWithThis, RouteLocationNormalized} from 'vue-router';
import {UserState, useUserStore} from '@/stores/user' import {useUserStore} from '@/stores/user'
import type {UserState} from '@/stores/user'
import type {Store} from 'pinia'; import type {Store} from 'pinia';
const cookieName = 'loginStatus' const cookieName = 'loginStatus'
@ -31,11 +32,11 @@ const getCookieValue = (cookieName: string): string => {
} }
// Pina is not ready when router is called the first time by app.use(), so we need to load it here // Pina is not ready when router is called the first time by app.use(), so we need to load it here
const getUserStore = (): UserState => { const getUserStore = (): UserState & Store => {
if (!userStore) { if (!userStore) {
userStore = useUserStore() userStore = useUserStore()
} }
return userStore as unknown as UserState return userStore as unknown as UserState & Store
} }
const loginRequired = (to: RouteLocationNormalized) => { const loginRequired = (to: RouteLocationNormalized) => {