Fixed delete button issues
This commit is contained in:
@@ -33,7 +33,7 @@ function listPizze(){
|
|||||||
<td>${pizza.nome}</td>
|
<td>${pizza.nome}</td>
|
||||||
<td>${pizza.prezzo}€</td>
|
<td>${pizza.prezzo}€</td>
|
||||||
<td><button onclick="alert('WIP')">Modifica</button>
|
<td><button onclick="alert('WIP')">Modifica</button>
|
||||||
<button onclick="deletePizza({pizza.id})">X</button></td>
|
<button onclick="deletePizza(${pizza.id})">X</button></td>
|
||||||
</tr>`;
|
</tr>`;
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ function deletePizza(id){
|
|||||||
redirect: "follow"
|
redirect: "follow"
|
||||||
};
|
};
|
||||||
|
|
||||||
fetch("http://localhost:5011/api/pizze/1", requestOptions)
|
fetch(apiUrl + "/api/pizze/" + id, requestOptions)
|
||||||
.then((response) => response.text())
|
.then((response) => response.text())
|
||||||
.then((result) => alert("Pizza eliminata con successo!"))
|
.then((result) => alert("Pizza eliminata con successo!"))
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user