-
+
diff --git a/script.js b/script.js
index e188447..83135d4 100644
--- a/script.js
+++ b/script.js
@@ -84,7 +84,7 @@ function editPizza(id){
}
}
-function addPizza(nome, id, prezzo){
+function addPizza(id, nome, prezzo){
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
@@ -105,10 +105,20 @@ function addPizza(nome, id, prezzo){
.then((response) => response.text())
.then((result) => {
alert("Pizza aggiunta con successo!");
- listPizze();
+ window.close();
})
.catch((error) => {
console.error(error)
alert("Errore nell'aggiunta, controllare la console per dettagli sull'errore.");
});
+}
+
+function handleAddPizza(event){
+ event.preventDefault();
+
+ const nome = document.getElementById("name").value;
+ const id = document.getElementById("id").value;
+ const prezzo = document.getElementById("price").value;
+
+ addPizza(id, nome, prezzo);
}
\ No newline at end of file