From 92960c4fa758ee68520ac3a201123bf282753336 Mon Sep 17 00:00:00 2001 From: Filip Rojek Date: Wed, 10 Jan 2024 15:36:59 +0100 Subject: [PATCH] Fix routing when logged out --- frontend/src/router/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/src/router/index.js b/frontend/src/router/index.js index 3564ddb..e0fd6d1 100644 --- a/frontend/src/router/index.js +++ b/frontend/src/router/index.js @@ -5,10 +5,8 @@ import LoginView from '../views/LoginView.vue' import userAPIS from '../api/user' const authGuard = async () => { - console.log('1tady') const data = await userAPIS.getUserStatus() if (!data.data) { - console.log('tady') throw router.push('/') } } @@ -59,7 +57,9 @@ router.beforeEach(async (to, from, next) => { if (requiresAuth) { const userStatus = await userAPIS.getUserStatus() if (!userStatus.data) { - throw router.push('/login') + router.replace('/login') + next() + return } }