diff --git a/app/components/todo/Todo.vue b/app/components/todo/Todo.vue index fc031ca..618a0f4 100644 --- a/app/components/todo/Todo.vue +++ b/app/components/todo/Todo.vue @@ -19,18 +19,37 @@ const checked = ref(isChecked(props.data)); const todoStore = useTodoStore(); - function onCheck() { - checked.value = true; - + function onClickCheck() { if (props.data.time?.type === "recurring") { - todoStore.checkTodo(props.data.uuid); + if (checked.value) { + uncheck(); + } else { + check(); + } } else { - setTimeout(() => { - todoStore.removeTodo(props.data.uuid); - }, 1000); + if (!checked.value) { + remove(); + } } } + function remove() { + checked.value = true; + setTimeout(() => { + todoStore.removeTodo(props.data.uuid); + }, 1000); + } + + function check() { + checked.value = true; + todoStore.checkTodo(props.data.uuid); + } + + function uncheck() { + checked.value = false; + todoStore.uncheckTodo(props.data.uuid); + } + const { filter } = useFilter(); const tagStore = useTagStore(); const categoryStore = useCategoryStore(); @@ -80,12 +99,7 @@