disable timer form submit while posting. wait until it returns

main
Matthew Huntington 4 months ago
parent 4de311abb4
commit 4078377ce5

@ -46,6 +46,7 @@
export default { export default {
data() { data() {
return { return {
submitting:false,
startTime:0, startTime:0,
savedPreviousSeconds:0, savedPreviousSeconds:0,
totalSeconds:0, totalSeconds:0,
@ -68,6 +69,11 @@
formatSeconds, formatSeconds,
submit(event){ submit(event){
event.preventDefault(); event.preventDefault();
if(this.submitting){
return
} else {
this.submitting = true
}
const reqBody = { const reqBody = {
description:description.value, description:description.value,
seconds: this.totalSeconds, seconds: this.totalSeconds,
@ -97,6 +103,9 @@
this.manualSeconds = 0 this.manualSeconds = 0
window.localStorage.setItem('lastTotalSeconds', this.totalSeconds); window.localStorage.setItem('lastTotalSeconds', this.totalSeconds);
this.$emit('loggedTime', reqBody) this.$emit('loggedTime', reqBody)
this.submitting = false
},()=>{
this.submitting = false
}); });
}, },
@ -238,7 +247,7 @@
<label>Practice Category</label> <label>Practice Category</label>
<CategoryChooser /> <CategoryChooser />
<input type="submit"/> <input :disabled="submitting" type="submit"/>
<label>Comments</label> <label>Comments</label>
<textarea v-model="comments"/> <textarea v-model="comments"/>

Loading…
Cancel
Save