addCategory zeigt auf den korrigierten API-Pfad

This commit is contained in:
Technoir committed 2026-10-06 17:49:50 +02:00
1 parent 6e39f469d3
commit f2090b684b
2 files changed
+5 -7

No files matched your search

@@ -25,11 +25,11 @@ public class ShoppingCategoryController {
@Autowired
private ShoppingItemRepository shoppingItemRepository;
@PostMapping("/api/list/{listID}/category/")
public ShoppingCategory addCategory(@PathVariable UUID listID, @RequestBody ShoppingCategoryDTO newCategory){
@PostMapping("/api/category")
public ShoppingCategory addCategory(@RequestBody ShoppingCategoryDTO newCategory){
String name = newCategory.categoryName();
ShoppingList list = shoppingListRepository.findById(listID).orElseThrow();
ShoppingList list = shoppingListRepository.findById(newCategory.listID()).orElseThrow();
ShoppingCategory category = new ShoppingCategory(name, List.of(),list);
+2 -4
View File
@@ -30,14 +30,12 @@ export async function deleteItem(itemID) {
}
export async function addCategory(listID, categoryName) {
const newCategory = await fetch(`/api/list/${listID}/category/`,
const newCategory = await fetch(`/api/category`,
{
method: "POST"
, body: JSON.stringify({ "categoryName": categoryName })
, body: JSON.stringify({ "categoryName": categoryName, "listID": listID })
, headers: { "Content-Type": "application/json" }
});
//listElements.push(new ShoppingCategory(categoryName, renderAddItemPrompt, renderItemList));
//renderItemList();
return await newCategory.json();
}