Merge branch 'dev_v1-admin' into debian12_v1-admin

This commit is contained in:
2025-09-16 11:20:37 +02:00
4 changed files with 115 additions and 4 deletions
+24
View File
@@ -165,3 +165,27 @@ export const createItem = async (
return { success: false };
}
};
export const handleEditItems = async (
itemId: number,
item_name: string,
can_borrow_role: string
) => {
try {
const response = await fetch("http://localhost:8002/api/updateItemByID", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${Cookies.get("token")}`,
},
body: JSON.stringify({ itemId, item_name, can_borrow_role }),
});
if (!response.ok) {
throw new Error("Failed to edit item");
}
return { success: true };
} catch (error) {
console.error("Error editing item:", error);
return { success: false };
}
};