json zu response geändert und success-checking angepasst

This commit is contained in:
Technoir committed 2026-10-17 15:43:32 +02:00
1 parent 719c63862e
commit d79be68bed
1 file changed
+6 -6
@@ -43,21 +43,21 @@ async function addCategory(categoryName) {
async function deleteItem(li) {
console.log(`deleting item ${li.dataset.id}`)
const json = await handleResponse(api.deleteItem(li.dataset.id), `error deleting item`);
if (json.ok) ui.deleteItem(li);
const response = await handleResponse(api.deleteItem(li.dataset.id), `error deleting item`);
if (response.ok) ui.deleteItem(li);
}
async function deleteCategory(deleteAllItems, categoryID) {
console.log(`deleting category with allItems: ${deleteAllItems} id: ${categoryID}`);
const json = await handleResponse(api.deleteCategory(deleteAllItems, categoryID), `error deleting category`);
const response = await handleResponse(api.deleteCategory(deleteAllItems, categoryID), `error deleting category`);
if (json.ok) ui.deleteCategory(deleteAllItems, categoryID);
if (response.ok) ui.deleteCategory(deleteAllItems, categoryID);
}
async function deleteAllDoneItems() {
console.log(`deleting all done items...`)
const json = await handleResponse(api.deleteAllDoneItems(currentList.dataset.id), `error deleting all done items`);
if (json.ok) ui.deleteAllDoneItems();
const response = await handleResponse(api.deleteAllDoneItems(currentList.dataset.id), `error deleting all done items`);
if (response.ok) ui.deleteAllDoneItems();
}
function init() {