From 39d573818f01075ac6ce0f4e4c443b15c7a291b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sz=C3=A1nt=C3=B3=20Zolt=C3=A1n?= Date: Wed, 16 Jan 2019 22:17:38 +0200 Subject: [PATCH 1/2] Skip redirect on auth error --- app/assets/vue/views/Login.vue | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/app/assets/vue/views/Login.vue b/app/assets/vue/views/Login.vue index a725a54..830530d 100644 --- a/app/assets/vue/views/Login.vue +++ b/app/assets/vue/views/Login.vue @@ -67,19 +67,22 @@ }, }, methods: { - performLogin () { - let payload = { login: this.$data.login, password: this.$data.password }, + performLogin() { + let payload = {login: this.$data.login, password: this.$data.password}, redirect = this.$route.query.redirect; - this.$store.dispatch('security/login', payload) .then(() => { - if (typeof redirect !== 'undefined') { - this.$router.push({path: redirect}); - } else { - this.$router.push({path: '/home'}); + if (!this.$store.getters['security/hasError']) { + if (typeof redirect !== 'undefined') { + this.$router.push({path: redirect}); + } else { + this.$router.push({path: '/home'}); + } } - }); + }).catch(() => { + console.log("error"); + }); }, }, } - \ No newline at end of file + From 88e543b9725a7aa3073cc9ddf2d7f270e21c19ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sz=C3=A1nt=C3=B3=20Zolt=C3=A1n?= Date: Wed, 16 Jan 2019 22:20:35 +0200 Subject: [PATCH 2/2] Remove console.log Rookie mistake :) --- app/assets/vue/views/Login.vue | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/assets/vue/views/Login.vue b/app/assets/vue/views/Login.vue index 830530d..81cba85 100644 --- a/app/assets/vue/views/Login.vue +++ b/app/assets/vue/views/Login.vue @@ -79,9 +79,7 @@ this.$router.push({path: '/home'}); } } - }).catch(() => { - console.log("error"); - }); + }); }, }, }