Skip to content

A self-hosted media server and file management system

fix: redirect guest checks for auth

aminnausin63694294ef96
diff --git a/resources/js/router/index.ts b/resources/js/router/index.ts
index be19b3c3..328c70ac 100644
--- a/resources/js/router/index.ts
+++ b/resources/js/router/index.ts
@@ -168,9 +168,9 @@ const router = createRouter({
});
const redirectAfterLogin = async (to: RouteLocationNormalizedGeneric, next: NavigationGuardNext, meta: RouteMeta) => {
- const { auth } = useAuthStore();
+ const { fetchUser } = useAuthStore();
- if (await auth()) {
+ if (await fetchUser()) {
// Logged in -> user and page is protected
next();
return;
@@ -194,9 +194,8 @@ const redirectAfterLogin = async (to: RouteLocationNormalizedGeneric, next: Navi
const redirectGuest = async (next: NavigationGuardNext) => {
const { userData } = storeToRefs(useAuthStore());
- const { auth } = useAuthStore();
- if (userData.value || (await auth())) {
+ if (userData.value) {
return next({ path: '/' });
}