From 25692f83719ffb05e06864c02c19aab7469fdb8e Mon Sep 17 00:00:00 2001 From: Wisdom Date: Wed, 15 Mar 2023 08:46:11 +0800 Subject: [PATCH] fix: inverted parameter for before each function (#585) --- src/router/permission.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/router/permission.ts b/src/router/permission.ts index 093f132..f8a3f3d 100644 --- a/src/router/permission.ts +++ b/src/router/permission.ts @@ -2,7 +2,7 @@ import type { Router } from 'vue-router' import { useAuthStoreWithout } from '@/store/modules/auth' export function setupPageGuard(router: Router) { - router.beforeEach(async (from, to, next) => { + router.beforeEach(async (to, from, next) => { const authStore = useAuthStoreWithout() if (!authStore.session) { try { @@ -12,7 +12,7 @@ export function setupPageGuard(router: Router) { next() } catch (error) { - if (from.path !== '/500') + if (to.path !== '/500') next({ name: '500' }) else next()