Make sure to only show the loading spinner and saved message when saving the description
This commit is contained in:
parent
f685ffbb13
commit
fde740784b
|
@ -6,7 +6,7 @@
|
|||
</span>
|
||||
Description
|
||||
<transition name="fade">
|
||||
<span class="is-small is-inline-flex" v-if="loading">
|
||||
<span class="is-small is-inline-flex" v-if="loading && saving">
|
||||
<span class="loader is-inline-block mr-2"></span>
|
||||
Saving...
|
||||
</span>
|
||||
|
@ -47,6 +47,7 @@ export default {
|
|||
return {
|
||||
task: {description: ''},
|
||||
saved: false,
|
||||
saving: false, // Since loading is global state, this variable ensures we're only showing the saving icon when saving the description.
|
||||
}
|
||||
},
|
||||
computed: mapState({
|
||||
|
@ -73,6 +74,8 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
save() {
|
||||
this.saving = true
|
||||
|
||||
this.$store.dispatch('tasks/update', this.task)
|
||||
.then(() => {
|
||||
this.$emit('input', this.task)
|
||||
|
@ -84,6 +87,9 @@ export default {
|
|||
.catch(e => {
|
||||
this.error(e, this)
|
||||
})
|
||||
.finally(() => {
|
||||
this.saving = false
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
Reference in New Issue