erstellen einer neuen kategorie per fetch() implementiert

This commit is contained in:
Technoir committed 2026-10-04 17:08:53 +02:00
1 parent 47815e073d
commit ae5c28dc8f
1 file changed
+9 -1
+9 -1
View File
@@ -6,10 +6,18 @@ const addCategoryForm = document.querySelector(".addCategoryForm")
const itemListElement = document.querySelector(".displayedList");
const deleteAllDoneItemsButton = document.querySelector(".deleteAllDoneItemsButton");
const currentList = document.querySelector(".list");
let listElements = []; // Liste der erstellten Items und Kategorien
function addNewCategory(categoryName) {
let id = currentList.id;
fetch(`/api/list/${id}/category/`,
{
method: "POST"
, body: JSON.stringify({ "categoryName": categoryName })
, headers: { "Content-Type": "application/json" }
}).then(r => console.log("Add new category"));
listElements.push(new ShoppingCategory(categoryName, renderAddItemPrompt, renderItemList));
renderItemList();
return 0;