diff --git a/src/components/PaySuperAuthForm.vue b/src/components/PaySuperAuthForm.vue index fe16e1e..2363a07 100644 --- a/src/components/PaySuperAuthForm.vue +++ b/src/components/PaySuperAuthForm.vue @@ -40,11 +40,14 @@ export default { } this.$emit('loadingStart'); - await this.authoriseWithLogin({ + const url = await this.authoriseWithLogin({ email: this.email, password: this.password, remember: true, }); + if (url) { + this.$router.push(url); + } this.$emit('loadingEnd'); }, }, diff --git a/src/components/PaySuperAutoLoginForm.vue b/src/components/PaySuperAutoLoginForm.vue index c6bcf15..8cc7cb7 100644 --- a/src/components/PaySuperAutoLoginForm.vue +++ b/src/components/PaySuperAutoLoginForm.vue @@ -28,7 +28,10 @@ export default { } this.$emit('loadingStart'); - await this.autoLogin({ previousLogin: this.previousLogin }); + const url = await this.autoLogin({ previousLogin: this.previousLogin }); + if (url) { + this.$router.push(url); + } this.$emit('loadingEnd'); }, }, diff --git a/src/components/PaySuperRegisterForm.vue b/src/components/PaySuperRegisterForm.vue index 32f57eb..5a4355a 100644 --- a/src/components/PaySuperRegisterForm.vue +++ b/src/components/PaySuperRegisterForm.vue @@ -54,11 +54,14 @@ export default { this.$emit('loadingStart'); - await this.registerWithEmail({ + const url = await this.registerWithEmail({ email: this.email, password: this.password, remember: true, }); + if (url) { + this.$router.push(url); + } this.$emit('loadingEnd'); }, }, diff --git a/src/store/AuthForm.js b/src/store/AuthForm.js index 3447584..e862a8d 100644 --- a/src/store/AuthForm.js +++ b/src/store/AuthForm.js @@ -1,9 +1,9 @@ import axios from 'axios'; -import { throttle } from 'lodash-es'; +// import { throttle } from 'lodash-es'; -function redirectToLogin(url) { - window.location.replace(url); -} +// function redirectToLogin(url) { +// window.location.replace(url); +// } export default { namespaced: true, @@ -28,15 +28,15 @@ export default { email, password, remember: (remember === '1'), - }, { - headers: { 'If-Unmodified-Since': (new Date()).toUTCString() }, }); - const throttled = throttle(redirectToLogin(data.url), 100); - throttled(); + return data.url; + // const throttled = throttle(redirectToLogin(data.url), 100); + // throttled(); } catch (error) { if (error.response) { commit('authError', error.response.data.error_message); } + return ''; } }, @@ -47,12 +47,14 @@ export default { challenge: rootState.challenge, previousLogin, }); - const throttled = throttle(redirectToLogin(data.url), 100); - throttled(); + return data.url; + // const throttled = throttle(redirectToLogin(data.url), 100); + // throttled(); } catch (error) { if (error.response) { commit('authError', error.response.data.error_message); } + return ''; } }, diff --git a/src/store/RegisterForm.js b/src/store/RegisterForm.js index a1e71e4..7a503fe 100644 --- a/src/store/RegisterForm.js +++ b/src/store/RegisterForm.js @@ -1,9 +1,9 @@ import axios from 'axios'; -import { throttle } from 'lodash-es'; +// import { throttle } from 'lodash-es'; -function redirectToLogin(url) { - window.location.replace(url); -} +// function redirectToLogin(url) { +// window.location.replace(url); +// } export default { namespaced: true, @@ -31,12 +31,14 @@ export default { password, remember: (remember === '1'), }); - const throttled = throttle(redirectToLogin(data.url), 100); - throttled(); + return data.url; + // const throttled = throttle(redirectToLogin(data.url), 100); + // throttled(); } catch (error) { if (error.response) { commit('registerError', error.response.data.error_message); } + return ''; } },