From 912123098e5fca6193ebb6f66ad06c8442d07861 Mon Sep 17 00:00:00 2001 From: Daan Wijns Date: Sun, 29 Aug 2021 11:26:13 +0200 Subject: [PATCH] fix: logout #286 --- src/components/Navbar/NavbarActions.vue | 2 +- src/router.js | 13 +------------ src/views/Login.vue | 7 +++++++ 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/components/Navbar/NavbarActions.vue b/src/components/Navbar/NavbarActions.vue index da6ed1a8..dcc81f3c 100644 --- a/src/components/Navbar/NavbarActions.vue +++ b/src/components/Navbar/NavbarActions.vue @@ -134,7 +134,7 @@ export default { methods: { logout() { this.$store.commit('LOGOUT') - this.$router.push('/login') + this.$router.push({ name: 'login' }) }, toggleSpeed() { qbit.toggleSpeedLimitsMode() diff --git a/src/router.js b/src/router.js index cfa44346..a1d2e0fe 100644 --- a/src/router.js +++ b/src/router.js @@ -25,19 +25,14 @@ const router = new Router({ name: 'login', component: Login, meta: { - public: true, // Allow access to even if not logged in - onlyWhenLoggedOut: true + public: true // Allow access to even if not logged in } } } - ] }) router.beforeEach(async (to, from, next) => { const isPublic = to.matched.some(record => record.meta.public) - const onlyWhenLoggedOut = to.matched.some( - record => record.meta.onlyWhenLoggedOut - ) const authenticated = isAuthenticated() if (!isPublic && !authenticated) { @@ -48,12 +43,6 @@ router.beforeEach(async (to, from, next) => { }) } - // Do not allow user to visit login page or register page - // if they are logged in - if (authenticated && onlyWhenLoggedOut) { - return next('/') - } - next() }) diff --git a/src/views/Login.vue b/src/views/Login.vue index b84dccde..358e0e06 100644 --- a/src/views/Login.vue +++ b/src/views/Login.vue @@ -48,6 +48,8 @@