delete in the backend
This commit is contained in:
parent
f73f862bcf
commit
ba6e5a9c17
3 changed files with 22 additions and 1 deletions
|
@ -48,6 +48,16 @@
|
|||
});
|
||||
}
|
||||
|
||||
function deleteTask(id) {
|
||||
axios.delete("/tasks/" + id, axiosConfig)
|
||||
.then((response) => {
|
||||
console.log(response);
|
||||
})
|
||||
.catch((err) => {
|
||||
showErrorToast(err.response.data.message);
|
||||
});
|
||||
}
|
||||
|
||||
function addTaskToTasks(task) {
|
||||
const newTask = document.createElement('div');
|
||||
newTask.classList.add('row', 'g-0', 'align-items-center', 'mb-1');
|
||||
|
@ -57,7 +67,7 @@
|
|||
<div class="col-2 form-check form-switch d-flex justify-content-center">
|
||||
<input class="text-center form-check-input" type="checkbox" ${task.Done && "checked"} role="switch" id="flexSwitchCheckDefault">
|
||||
</div>
|
||||
<button class="col-1 btn btn-danger"><i class="bi bi-trash"></i></button>
|
||||
<button onclick="deleteTask(${task.ID})" class="col-1 btn btn-danger"><i class="bi bi-trash"></i></button>
|
||||
`;
|
||||
tasksEl.appendChild(newTask);
|
||||
}
|
||||
|
|
Reference in a new issue