Skip to content

Commit 26a11b8

Browse files
committed
add markDonde
1 parent 0848c5a commit 26a11b8

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/components/TodoItem.vue

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,17 @@
22
<li>
33
<span v-bind:class="{done:todo.done}">
44
<input type="checkbox" v-if="!todo.done" @change="markDone(todo)"/>
5-
<!--<strong>{{todo.id}}.</strong>-->
65
{{todo.task}}
76
</span>
8-
<button
9-
class="remove_btn"
10-
v-on:click="$emit('remove-todo',todo.id)"
11-
>
7+
<button class="remove_btn" v-on:click="$emit('remove-todo',todo.id)">
128
Удалить
139
</button>
1410
</li>
1511
</template>
1612

1713
<script>
14+
import TodosService from "../api/todo.requests";
15+
1816
export default {
1917
name: "TodoItem",
2018
props: {
@@ -24,8 +22,10 @@ export default {
2422
}
2523
},
2624
methods: {
27-
markDone(todo){
25+
async markDone(todo){
2826
todo.done = !todo.done
27+
await TodosService.updateTodoStatus(todo.id)
28+
.catch((error) => console.error(error.message))
2929
}
3030
}
3131
}
@@ -56,5 +56,6 @@ export default {
5656
5757
.done {
5858
text-decoration: line-through;
59+
5960
}
6061
</style>

0 commit comments

Comments
 (0)