reset list only if there are tasks

This commit is contained in:
Julien Calixte
2023-04-20 00:07:08 +02:00
parent 4990a1de0c
commit fb498ba305

View File

@@ -1,9 +1,12 @@
<script setup lang="ts">
import TaskList from '@/modules/task/components/TaskList.vue'
import { useTaskStore } from '@/modules/task/stores/useTask.store'
import { computed } from 'vue'
const taskStore = useTaskStore()
const hasTask = computed(() => taskStore.tasks.length > 0)
const resetTasks = () => {
if (window.confirm('are you sure to reset all your tasks?')) {
taskStore.reset()
@@ -19,7 +22,7 @@ const resetTasks = () => {
>
</div>
<task-list />
<div>
<div v-if="hasTask">
<button class="button is-danger" @click="resetTasks">reset list</button>
</div>
</main>