add a confirm modal before resetting all tasks

This commit is contained in:
Julien Calixte
2023-04-19 23:45:01 +02:00
parent 7e91a5c1ee
commit 7b0d2d7ae4
2 changed files with 24 additions and 7 deletions

View File

@@ -3,16 +3,33 @@ import TaskList from '@/modules/task/components/TaskList.vue'
import { useTaskStore } from '@/modules/task/stores/useTask.store'
const taskStore = useTaskStore()
const resetTasks = () => {
if (window.confirm('are you sure to reset all your tasks?')) {
taskStore.reset()
}
}
</script>
<template>
<main>
<router-link :to="{ name: 'new-task' }" class="button is-primary"
>New task</router-link
>
<div>
<router-link :to="{ name: 'new-task' }" class="button is-primary"
>New task</router-link
>
</div>
<task-list />
<button class="button is-danger" @click="() => taskStore.reset()">
reset list
</button>
<div>
<button class="button is-danger" @click="resetTasks">reset list</button>
</div>
</main>
</template>
<style scoped>
main {
display: flex;
flex-direction: column;
justify-content: space-between;
height: 60vh;
}
</style>