feat: add deleteItem function to API for item removal
This commit is contained in:
parent
c3044638b5
commit
dd2f62593a
1 changed files with 5 additions and 0 deletions
|
|
@ -50,6 +50,11 @@ export async function updateItemName(itemId: string, name: string): Promise<Item
|
||||||
return res.json();
|
return res.json();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function deleteItem(itemId: string): Promise<void> {
|
||||||
|
const res = await fetch(`${API_BASE}/items/${itemId}`, { method: "DELETE" });
|
||||||
|
if (!res.ok) throw new Error("Failed to delete item");
|
||||||
|
}
|
||||||
|
|
||||||
export async function deleteItemTag(itemId: string, tagId: string): Promise<Item> {
|
export async function deleteItemTag(itemId: string, tagId: string): Promise<Item> {
|
||||||
const res = await fetch(`${API_BASE}/items/${itemId}/tags/${tagId}`, {
|
const res = await fetch(`${API_BASE}/items/${itemId}/tags/${tagId}`, {
|
||||||
method: "DELETE",
|
method: "DELETE",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue