addItem async für json
This commit is contained in:
1 parent
600c39352a
commit
65cdc95b72
1 file changed
+5
-4
@@ -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) {
|
||||
|
||||
Reference in new issue
Block a user