@@ -8,6 +8,7 @@ import useLayoutStore, { Layout } from "@/store/modules/layout";
88import useNamespacesStore from "@/store/modules/namespaces" ;
99import useUsersStore from "@/store/modules/users" ;
1010import useWebEndpointsStore from "@/store/modules/web_endpoints" ;
11+ import { computed } from "vue" ;
1112
1213export const handleAcceptInvite = async ( to : RouteLocationNormalized , from : RouteLocationNormalized , next : NavigationGuardNext ) => {
1314 const namespacesStore = useNamespacesStore ( ) ;
@@ -18,7 +19,7 @@ export const handleAcceptInvite = async (to: RouteLocationNormalized, from: Rout
1819 sig : ( to . query . sig || from . query . sig ) as string ,
1920 } ) ;
2021 const { userStatus } = namespacesStore ;
21- const { isLoggedIn } = useAuthStore ( ) ;
22+ const isLoggedIn = computed ( ( ) => useAuthStore ( ) . isLoggedIn ) ;
2223
2324 switch ( userStatus ) {
2425 case "invited" :
@@ -34,7 +35,7 @@ export const handleAcceptInvite = async (to: RouteLocationNormalized, from: Rout
3435 } ) ;
3536 return ;
3637 case "confirmed" :
37- if ( ! isLoggedIn ) {
38+ if ( ! isLoggedIn . value ) {
3839 next ( {
3940 path : "/login" ,
4041 query : { redirect : "/accept-invite" , ...to . query } ,
@@ -554,10 +555,10 @@ export const router = createRouter({
554555router . beforeEach (
555556 async ( to : RouteLocationNormalized , from : RouteLocationNormalized , next : NavigationGuardNext ) => {
556557 await useUsersStore ( ) . fetchSystemInfo ( ) ;
557- const { isLoggedIn } = useAuthStore ( ) ;
558+ const isLoggedIn = computed ( ( ) => useAuthStore ( ) . isLoggedIn ) ;
558559 const requiresAuth = to . meta . requiresAuth ?? true ;
559560
560- if ( ! isLoggedIn && requiresAuth ) return next ( {
561+ if ( ! isLoggedIn . value && requiresAuth ) return next ( {
561562 name : "Login" ,
562563 query : { redirect : to . fullPath } ,
563564 } ) ;
0 commit comments