Added an option to reset timers daily

This commit is contained in:
2021-11-06 01:50:05 +03:00
parent 6cd4a91ec7
commit 9f07a0897f
13 changed files with 143 additions and 8 deletions

View File

@@ -6,6 +6,8 @@
</template>
<script>
import { mapState, mapMutations } from 'vuex';
import TheCategoryBar from '@/components/TheCategoryBar.vue';
import TheTaskList from './TheTaskList.vue';
@@ -20,7 +22,18 @@ export default {
selectedCategory: undefined,
};
},
computed: {
...mapState(['midnightReset', 'lastReset']),
},
beforeMount() {
const lastMidnight = new Date();
lastMidnight.setHours(0, 0, 0, 0);
if (this.midnightReset && this.lastReset < lastMidnight) {
this.resetTasks();
}
},
methods: {
...mapMutations(['resetTasks']),
select(category) {
this.selectedCategory = category;
},