erstellen einer neuen kategorie per fetch() implementiert
This commit is contained in:
1 parent
47815e073d
commit
ae5c28dc8f
1 file changed
+9
-1
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user