Skip to content

Commit

Permalink
Not clearing button on failure
Browse files Browse the repository at this point in the history
  • Loading branch information
edwh committed Sep 16, 2024
1 parent eae3c0a commit 1d89a8b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
1 change: 0 additions & 1 deletion resources/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -1299,7 +1299,6 @@ jQuery(document).ready(function () {
// resources/js/components. Lower level components can be included from within those as normal;
// they don't need listing here.
$(".vue").each(function(index) {
console.log('Create vue', $(this).get(0))
new Vue({
el: $(this).get(0),
store: store,
Expand Down
10 changes: 6 additions & 4 deletions resources/js/components/EventAddEdit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -339,12 +339,11 @@ export default {
async submit(callback) {
// Check the form is valid.
this.$v.$touch()
let success = false
if (this.$v.$invalid) {
// It's not - prevent the submit.
console.log("Not valid", this.$v)
e.preventDefault()
console.log("Not valid event", this.$v)
this.validationFocusFirstError()
} else {
if (this.creating) {
Expand All @@ -364,6 +363,7 @@ export default {
if (id) {
// Success. Emitting this event will cause the parent to re-render us in the edit view
this.$emit('created', id)
success = true
} else {
this.failed = true
}
Expand Down Expand Up @@ -399,14 +399,16 @@ export default {
if (this.moderate == 'approve') {
this.eventApproved = true
}
success = true
} else {
this.failed = true
}
}
}
}
callback()
callback(success)
}
}
}
Expand Down
5 changes: 4 additions & 1 deletion resources/js/components/GroupAddEdit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ export default {
// this page and the subcomponents have form inputs with suitable names.
this.failed = false
this.edited = false
let success = false
this.$v.$touch()
Expand Down Expand Up @@ -401,6 +402,7 @@ export default {
if (id) {
// Success. Go to the edit page.
window.location = '/group/edit/' + id
success = true
} else {
this.failed = true
}
Expand Down Expand Up @@ -432,6 +434,7 @@ export default {
// group approval status might not have been updated yet. Handle this locally.
this.approved = this.approved || this.moderate === 'approve'
this.edited = true
success = true
} else {
this.failed = true
}
Expand All @@ -440,7 +443,7 @@ export default {
}
}
callback()
callback(success)
}
}
}
Expand Down
8 changes: 5 additions & 3 deletions resources/js/components/SpinButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,16 @@ export default {
}, this.minimumSpinTime)
})
},
finishSpinner() {
finishSpinner(success) {
clearTimeout(this.timer)
this.cancelLoading().then(() => {
if (this.doneIcon) {
if (success && this.doneIcon) {
this.done = true
setTimeout(() => {
this.done = false
}, this.timeout)
} else {
this.done = false
}
})
},
Expand All @@ -164,7 +166,7 @@ export default {
this.done = false
this.loading = true
this.$emit('handle', this.finishSpinner)
this.timer = setTimeout(forgottenCallback, 20 * 1000)
this.timer = setTimeout(this.forgottenCallback, 20 * 1000)
}
}
},
Expand Down

0 comments on commit 1d89a8b

Please sign in to comment.