addItem für frotnend implemenentiert

das item wird entsprechend nach vorhandener categoryID einer Kategorie
unterstellt oder nicht

fixes #3
This commit is contained in:
Technoir committed 2026-10-06 16:28:09 +02:00
1 parent 65cdc95b72
commit ab8a85e1f1
1 file changed
+11 -1
@@ -1,7 +1,17 @@
import { ShoppingCategory } from "./ShoppingCategory.js";
import { ShoppingItem } from "./ShoppingItem.js";
export function addItem() {
export function addItem(itemAsJSON) {
let list;
if (!itemAsJSON.categoryID) {
list = document.querySelector(".displayedList");
} else {
list = document.getElementById(`${itemAsJSON.categoryID}`).querySelector("ul");
}
const item = ShoppingItem.fromJSON(itemAsJSON);
list.appendChild(item.render());
}
export function deleteItem(li) {