diff --git a/src/router/guard.ts b/src/router/guard.ts index 38fc01d..37957a6 100644 --- a/src/router/guard.ts +++ b/src/router/guard.ts @@ -4,6 +4,9 @@ export function createRouterGuard(router: Router) { router.beforeEach(async (to, from, next) => { const userStore = useUserStore(); if (to.meta.requiresAuth && !userStore.isAuthenticated) { + if (from.path === "/auth/login") { + return next("/"); + } const redirect = encodeURIComponent(to.fullPath); return next({ path: "/auth/login", query: { redirect } }); }