Porgressbar und Löschen is kapput

This commit is contained in:
nikolaswollenberg 2024-01-30 11:15:22 +01:00
parent 074be3fac7
commit 6427572586

View File

@ -104,7 +104,7 @@
{{ habit.note }} {{ habit.note }}
</div> </div>
<button type="button" class="btn btn-xs btn-danger rounded-circle" style="width: 40px; height: 40px" onclick="deleteHabit('{{habit.id}}')"> <button type="button" class="btn btn-xs btn-danger rounded-circle" data-bs-toggle="modal" data-bs-target="#exampleModal" style="width: 40px; height: 40px" onclick="() => { let habitId = {{habit.id}} }">
<i class="bi bi-trash3"></i> <i class="bi bi-trash3"></i>
</button> </button>
<div class="col-12"> <div class="col-12">
@ -118,6 +118,26 @@
</ul> </ul>
</div> </div>
<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title fs-5" id="exampleModalLabel">Modal title</h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary btn-danger" onclick="deleteHabit(habitId) ">Löschen</button>
</div>
</div>
</div>
</div>
<script> <script>
function sendPostRequest(checkboxId) { function sendPostRequest(checkboxId) {
// Get the checkbox element using the provided ID // Get the checkbox element using the provided ID
@ -148,6 +168,7 @@
function deleteHabit(habitId) { function deleteHabit(habitId) {
// Make a POST request to /delete with the habit id // Make a POST request to /delete with the habit id
axios.post('/delete', { habitId: habitId }, { axios.post('/delete', { habitId: habitId }, {
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'