Added resync for completed todos (#9821)

This commit is contained in:
Keith Holliday
2018-01-22 08:19:47 -07:00
committed by GitHub
parent d4e0417c48
commit 7083dc7e05
2 changed files with 12 additions and 0 deletions

View File

@@ -331,6 +331,7 @@ export default {
this.isUserDropdownOpen = !this.isUserDropdownOpen;
},
sync () {
this.$root.$emit('habitica::resync-requested');
return Promise.all([
this.$store.dispatch('user:fetch', {forceLoad: true}),
this.$store.dispatch('tasks:fetchUserTasks', {forceLoad: true}),

View File

@@ -467,6 +467,17 @@ export default {
this.$root.$on('buyModal::boughtItem', () => {
this.forceRefresh = new Date();
});
if (this.type !== 'todo') return;
this.$root.$on('habitica::resync-requested', () => {
if (this.activeFilters.todo.label !== 'complete2') return;
this.loadCompletedTodos(true);
});
},
destroyed () {
this.$root.$off('buyModal::boughtItem');
if (this.type !== 'todo') return;
this.$root.$off('habitica::resync-requested');
},
methods: {
...mapActions({