added working item change route

This commit is contained in:
2025-09-16 11:13:19 +02:00
parent 755ebfd06b
commit b3ddfd9aa5
3 changed files with 24 additions and 7 deletions

View File

@@ -163,9 +163,20 @@ export const handleEditItems = async (
can_borrow_role: string
) => {
try {
// write the logic for editing an item
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 };
}
};
};