refact toDo
This commit is contained in:
@@ -38,15 +38,14 @@
|
||||
draggable
|
||||
@dragstart='startDrag($event, toDo)'
|
||||
class='drag-el todo flex justify-between items-center bg-white rounded-sm mb-1 px-2 py-1' >
|
||||
<div class="flex flex-1">
|
||||
<div class="flex items-center flex-1 todo">
|
||||
<svg-vue icon="draggable" class="w-4 block mr-2 cursor-move" />
|
||||
<ToDo :name="toDo.data.attributes.data.name"
|
||||
:checked="toDo.data.attributes.data.checked_at"
|
||||
<ToDo :to-do="toDo"
|
||||
:id-list="toDoList.data.to_do_list_id"
|
||||
:id-to-do="toDo.data.to_do_id"
|
||||
class="flex-1 bg-blue" />
|
||||
<input type="checkbox" :checked="toDo.data.attributes.data.checked_at" @click="checked(toDo, index)">
|
||||
<span @click="deleteToDo(toDo, index)" class="cursor-pointer ml-2 font-bold">X</span>
|
||||
<span @click="deleteToDo(toDo, index)" class="cursor-pointer ml-2 font-bold edit-icon">
|
||||
<svg-vue icon="close" class="w-4" />
|
||||
</span>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
@@ -149,16 +148,6 @@ export default {
|
||||
console.log('Internal Error, Unable to delete contact.' + errorRes)
|
||||
})
|
||||
},
|
||||
checked: function (toDo, position) {
|
||||
// eslint-disable-next-line no-undef
|
||||
axios.patch('/api/to-do-lists/' + this.toDoList.data.to_do_list_id + '/to-do/' + toDo.data.to_do_id + '/check')
|
||||
.then(res => {
|
||||
this.toDoList.data.attributes.data.to_dos.data[position].data.attributes.data.checked_at = res.data.data.attributes.data.checked_at
|
||||
})
|
||||
.catch(errorRes => {
|
||||
console.log('Internal Error, Unable to delete contact.' + errorRes)
|
||||
})
|
||||
},
|
||||
destroy: function () {
|
||||
// eslint-disable-next-line no-undef
|
||||
axios.delete('/api/to-do-lists/' + this.$route.params.id)
|
||||
|
||||
Reference in New Issue
Block a user