sync before showing yesterdailies modal

This commit is contained in:
Matteo Pagliazzi
2017-09-07 14:21:05 +02:00
parent 5ec7815cfe
commit e54dcd2859

View File

@@ -270,8 +270,13 @@ export default {
// Setup a listener that executes 10 seconds after the next cron time
const nextCronIn = Number(nextCron.format('x')) - Date.now() + 10 * 1000;
setInterval(() => {
this.user.needsCron = true; // @TODO move to action? not sent to the server
setInterval(async () => {
// Sync the user before showing the modal
await Promise.all([
this.$store.dispatch('user:fetch', {forceLoad: true}),
this.$store.dispatch('tasks:fetchUserTasks', {forceLoad: true}),
]);
this.runYesterDailies();
}, nextCronIn);
},