export function getCategories(withProducts: boolean = false): Promise { return fetch(withProducts ? "/api/categories/with-products" : "/api/categories"); } export function getCategory(categoryId: string): Promise { return fetch("/api/categories/" + categoryId); } export function createCategory(name: string, disabled: boolean): Promise { return fetch("/api/categories/create?" + new URLSearchParams({ name })); } export function updateCategory(categoryId: string, newName: string): Promise { return fetch("/api/categories/" + categoryId + "/update?" + new URLSearchParams({ newName })); } export function deleteCategory(categoryId: string): Promise { return fetch("/api/categories/" + categoryId + "/delete", { method: "delete" }); } export function enableCategory(categoryId: string): Promise { return fetch("/api/categories/" + categoryId + "/enable"); } export function disableCategory(categoryId: string): Promise { return fetch("/api/categories/" + categoryId + "/disable"); }