diff --git a/src/components/Cards/CreateAccount.vue b/src/components/Cards/CreateAccount.vue index 0af48906..6d8f821b 100644 --- a/src/components/Cards/CreateAccount.vue +++ b/src/components/Cards/CreateAccount.vue @@ -156,12 +156,16 @@ export default { this.error.inputPassword = error this.error.inputPasswordConfirmation = error this.error.terms = error - this.inFlight = false + this.setInFlight(false) + }, + setInFlight (inFlight) { + this.inFlight = inFlight + this.$emit('account-creation-in-flight', inFlight) }, createaccount (evt) { evt.preventDefault() // Request is processing - this.inFlight = true + this.setInFlight(true) // Reset errors this.resetErrorState() @@ -186,7 +190,7 @@ export default { // If the error are not empty then dont submit the request if (this.hasError) { - this.inFlight = false + this.setInFlight(false) return } @@ -224,8 +228,11 @@ export default { } this.$store.dispatch('logout') - this.inFlight = false + this.setInFlight(false) }) + }).catch(err => { + console.error(err) + this.setGeneralErrorState() }) }, createSuccessful (success) { @@ -242,7 +249,6 @@ export default { console.log(err) // TODO better error messages.. this.setGeneralErrorState('Post account creation authentication failed!') - this.inFlight = false }) }, checkCurrentLogin () { diff --git a/src/components/Cards/ForgottenPassword.vue b/src/components/Cards/ForgottenPassword.vue index b0241264..a87c3d21 100644 --- a/src/components/Cards/ForgottenPassword.vue +++ b/src/components/Cards/ForgottenPassword.vue @@ -81,6 +81,9 @@ export default { this.$store .dispatch('forgottenPassword', { email }) + .then(() => { + this.inFlight = false + }) }, }, } diff --git a/src/components/Cards/Login.vue b/src/components/Cards/Login.vue index 2e8eddb5..acf7ae93 100644 --- a/src/components/Cards/Login.vue +++ b/src/components/Cards/Login.vue @@ -77,6 +77,7 @@ export default { login (evt) { evt.preventDefault() this.loggingIn = true + this.$emit('login-in-flight', true) const email = this.email const password = this.password this.errorMessage = '' @@ -96,6 +97,7 @@ export default { }) this.loggingIn = false + this.$emit('login-in-flight', false) }) }, }, diff --git a/src/components/Pages/CreateAccount.vue b/src/components/Pages/CreateAccount.vue index e473334d..6bc65d73 100644 --- a/src/components/Pages/CreateAccount.vue +++ b/src/components/Pages/CreateAccount.vue @@ -1,7 +1,7 @@