diff --git a/src/components/ToDo.vue b/src/components/ToDo.vue index e6389a1..737a200 100644 --- a/src/components/ToDo.vue +++ b/src/components/ToDo.vue @@ -1,7 +1,7 @@ @@ -17,6 +17,20 @@ export default { type: Number, required: true } + }, + methods: { + async updateTodo(e) { + let id = this.todo.id; + let completed = e.target.checked; + let data = { + completed + } + let response = await fetch(`http://localhost:3000/api/task/${id}`, { + method: 'put', + headers: {"Content-Type": "application/json"}, + body: JSON.stringify(data) + }); + } } }