Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions src/components/Cards/CreateAccount.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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
}

Expand Down Expand Up @@ -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) {
Expand All @@ -242,7 +249,6 @@ export default {
console.log(err)
// TODO better error messages..
this.setGeneralErrorState('Post account creation authentication failed!')
this.inFlight = false
})
},
checkCurrentLogin () {
Expand Down
3 changes: 3 additions & 0 deletions src/components/Cards/ForgottenPassword.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ export default {

this.$store
.dispatch('forgottenPassword', { email })
.then(() => {
this.inFlight = false
})
},
},
}
Expand Down
2 changes: 2 additions & 0 deletions src/components/Cards/Login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ''
Expand All @@ -96,6 +97,7 @@ export default {
})

this.loggingIn = false
this.$emit('login-in-flight', false)
})
},
},
Expand Down
6 changes: 4 additions & 2 deletions src/components/Pages/CreateAccount.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<v-container class="fill-height" fluid >
<v-row align="center" justify="center">
<CreateAccountCard title="Sign up" buttonText="Create Account"/>
<CreateAccountCard title="Sign up" buttonText="Create Account" @account-creation-in-flight="inFlight = $event"/>
</v-row>
<v-row align="center" justify="center">
<v-col class="needs-padding">
Expand All @@ -28,7 +28,9 @@ export default {
CreateAccountCard,
},
data () {
return {}
return {
inFlight: false,
}
},
}
</script>
Expand Down
6 changes: 4 additions & 2 deletions src/components/Pages/Login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<v-main class="pa-1">
<v-container class="fill-height" fluid >
<v-row align="center" justify="center">
<LoginCard title="Log in" buttonText="Log in"/>
<LoginCard title="Log in" buttonText="Log in" @login-in-flight="inFlight = $event"/>
</v-row>
<v-row justify="center" >
<div>
Expand All @@ -28,7 +28,9 @@ export default {
LoginCard,
},
data () {
return {}
return {
inFlight: false,
}
},
}
</script>
Expand Down
8 changes: 7 additions & 1 deletion src/components/Pages/ManageWiki/Cards/Skin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<v-card-actions>
<v-tooltip top>
<template v-slot:activator="{ on, attrs }">
<v-btn v-bind="attrs" v-on="on" @click="doSetSkin">Set Skin</v-btn>
<v-btn v-bind="attrs" v-on="on" :disabled="inFlight" @click="doSetSkin">Set Skin</v-btn>
</template>
<span>It may take up to 10 seconds for changes to be reflected on your wiki</span>
</v-tooltip>
Expand Down Expand Up @@ -55,6 +55,8 @@ export default {
],
skinId: '',
message: false,
inFlight: false,
error: [],
}
},
created () {
Expand All @@ -69,6 +71,7 @@ export default {
doSetSkin () {
const wiki = this.wikiId
const value = this.skin.value
this.inFlight = true

this.$store
.dispatch('updateSkin', { wiki, value })
Expand All @@ -79,6 +82,9 @@ export default {
console.error(err.response)
this.$refs.message.show('error', 'Something went wrong while updating your default skin. Please try again.')
})
.then(() => {
this.inFlight = false
})
},
},
}
Expand Down
Loading