From 1709552ed4eabb72dcfbad1fc005ad41d47776e0 Mon Sep 17 00:00:00 2001 From: tone <3341154833@qq.com> Date: Sun, 1 Sep 2024 15:47:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=B7=AF=E7=94=B1=E5=AE=88?= =?UTF-8?q?=E5=8D=ABnext=E5=A4=9A=E6=AC=A1=E8=B0=83=E7=94=A8=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tonecn/src/router/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tonecn/src/router/index.ts b/tonecn/src/router/index.ts index 91eea19..7a15511 100644 --- a/tonecn/src/router/index.ts +++ b/tonecn/src/router/index.ts @@ -52,9 +52,9 @@ const router = createRouter({ router.beforeEach((to, from, next) => { const isAuthenticated = !!localStorage.getItem('jwtToken'); if (to.name === 'dashboard' && !isAuthenticated) { - next({ name: 'login' }); + return next({ name: 'login' }); } else if (to.name === 'login' && isAuthenticated) { - next({ name: 'dashboard' }); + return next({ name: 'dashboard' }); } next() })