summaryrefslogtreecommitdiff
path: root/src/router
diff options
context:
space:
mode:
authorYoshie Muranaka <yoshiemuranaka@gmail.com>2020-05-15 18:06:46 +0300
committerDerick Montague <derick.montague@ibm.com>2020-05-16 23:50:48 +0300
commit68069e1955f63219601a9dd9100b56075fb2099c (patch)
treeaf3d236c24cfe9bd6862576eb189bdc3cacf49cf /src/router
parenta3cbc659093a349adb998b36b16fbb382109868f (diff)
downloadwebui-vue-68069e1955f63219601a9dd9100b56075fb2099c.tar.xz
Add logout commit for 401 response
Change the authentication logout from router to api interceptor, so that if a user accidentally navigates to login page by clicking the browser back button, they aren't automatically logged out. Logouts would occur when hitting a 401 response or if the user clicks the logout button from app header. Signed-off-by: Yoshie Muranaka <yoshiemuranaka@gmail.com> Change-Id: I6290070b63e724b75b3ac2fc39b3c7e814fbfc3e
Diffstat (limited to 'src/router')
-rw-r--r--src/router/index.js3
1 files changed, 0 insertions, 3 deletions
diff --git a/src/router/index.js b/src/router/index.js
index 33743fe0..c3d44390 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -98,9 +98,6 @@ const router = new VueRouter({
});
router.beforeEach((to, from, next) => {
- // Commit logout to remove XSRF-TOKEN cookie when
- // redirected to login page (eg 401 response)
- if (to.name === 'login') store.commit('authentication/logout');
if (to.matched.some(record => record.meta.requiresAuth)) {
if (store.getters['authentication/isLoggedIn']) {
next();