addItem async für json

This commit is contained in:
Technoir committed 2026-10-06 16:27:08 +02:00
1 parent 600c39352a
commit 65cdc95b72
1 file changed
+5 -4
+5 -4
View File
@@ -6,10 +6,11 @@ const addCategoryForm = document.querySelector(".addCategoryForm");
const addItemForm = document.querySelector(".addItemForm");
const currentList = document.querySelector(".list");
function addItem(itemName, itemAmount, categoryID) {
console.log(`${currentList.id}, ${itemName}, ${itemAmount}, ${categoryID}`)
api.addItem(currentList.id, itemName, itemAmount, categoryID);
ui.addItem();
async function addItem(itemName, itemAmount, categoryID) {
console.log(` adding item with id:${currentList.id}, name: ${itemName}, amount: ${itemAmount}, category: ${categoryID}`)
const itemAsJSON = await api.addItem(currentList.id, itemName, itemAmount, categoryID);
console.log(`rendering frointend item: ${itemAsJSON}`);
ui.addItem(itemAsJSON);
}
async function addCategory(categoryName) {