From 776c0d1a06d0edf61a3cb2d2725f2fec475dc348 Mon Sep 17 00:00:00 2001 From: Lera24 Date: Wed, 22 May 2024 00:53:05 +0300 Subject: [PATCH] hotfix: back in prev step in login when error[WTEL-4563] --- src/api/instance.js | 4 ++-- src/components/auth/login/the-login.vue | 16 +++++++++++++++- src/components/auth/the-auth.vue | 11 ++++++++++- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/src/api/instance.js b/src/api/instance.js index d4b983d3..11f011b9 100644 --- a/src/api/instance.js +++ b/src/api/instance.js @@ -71,8 +71,8 @@ instance.interceptors.response.use( type: 'error', text: error.detail || error.response.data.detail, }); - } - return Promise.reject(error.response.data); + } + return Promise.reject(error); }, ); diff --git a/src/components/auth/login/the-login.vue b/src/components/auth/login/the-login.vue index 03f59caa..35689018 100644 --- a/src/components/auth/login/the-login.vue +++ b/src/components/auth/login/the-login.vue @@ -40,6 +40,12 @@ import SecondStep from '../login/steps/the-login-second-step.vue'; import ThirdStep from './steps/the-login-third-step.vue'; export default { name: 'the-login', + props: { + isBackPrevStep: { + type: Boolean, + default: false, + }, + }, data: () => ({ activeStep: 1, isFirstStepSubmitting: false, @@ -91,7 +97,7 @@ export default { this.activeStep = this.activeStep - 1; } - if (this.activeStep === 3) { + if (this.activeStep === 2 && this.enabledTfa) { this.setProp({ prop: 'totp', value: '' }); } }, @@ -128,6 +134,14 @@ export default { this.resetState(); }, + watch: { + isBackPrevStep: { + handler(value) { + if(value && this.activeStep === 3) this.backPrevStep(); + } + } + } + }; diff --git a/src/components/auth/the-auth.vue b/src/components/auth/the-auth.vue index 8d27e641..82c530dd 100644 --- a/src/components/auth/the-auth.vue +++ b/src/components/auth/the-auth.vue @@ -15,8 +15,9 @@

{{ currentTab.title }}

@@ -83,6 +84,7 @@ export default { new Pagination({ type: 'bullet' }), new AutoPlay({ duration: 9000, stopOnHover: false }), ], + isBackPrevStepInLogin: false, }), computed: { ...mapState('appearance', { @@ -113,6 +115,13 @@ export default { const registerTab = this.tabs.find(({ value }) => value === 'register'); this.currentTab = this.$route.query.reset ? registerTab : loginTab; }, + async authorization(tab) { + try { + await this.submitAuth(tab) + } catch (err) { + if(tab === 'login' && err.code === 400) this.isBackPrevStepInLogin = true; + } + } }, created() { this.setInnitialTab();