This commit is contained in:
Technoir committed 2026-10-15 11:38:19 +02:00
1 parent c9c38f07ad
commit 00ac28aebf
5 files changed
-14

No files matched your search

@@ -1,4 +1,3 @@
export class ShoppingCategory extends HTMLElement {
static get observedAttributes() { return ["category-name"] }
@@ -7,7 +7,6 @@ export async function addCategory(listID, categoryName) {
});
}
export async function editCategory(categoryID, toChange) {
return await fetch(`/api/categories/${categoryID}`,
{
@@ -1,5 +1,3 @@
export async function addItem(listID, itemName, itemAmount, categoryID) {
return await fetch(`/api/items`,
{
@@ -14,7 +12,6 @@ export async function addItem(listID, itemName, itemAmount, categoryID) {
});
}
export async function deleteItem(itemID) {
return await fetch(`/api/items/${itemID}`, { method: "DELETE" });
@@ -32,9 +29,5 @@ export async function editItem(itemID, toChange) {
}
export async function deleteAllDoneItems(listID) {
return await fetch(`/api/lists/${listID}/items?done=true`, { method: "DELETE" });
}
@@ -1,6 +1,5 @@
import { showError } from "./error.js";
export async function handleResponse(promise, errorMsg) {
const response = await promise;
@@ -1,9 +1,7 @@
export function abortEditing(formElement, old) {
formElement.replaceWith(old);
}
export function createEditForm(fields) {
const editForm = document.createElement("form");
const abortButton = document.createElement("button");
@@ -31,10 +29,8 @@ export function createEditForm(fields) {
return editForm;
}
export function setElementAttributes(element, attributes) {
for (const [attr, val] of Object.entries(attributes)) element.setAttribute(attr, val);
}