added changeSafeState function

This commit is contained in:
2025-09-16 13:00:15 +02:00
parent b3ddfd9aa5
commit 5159877d8d
4 changed files with 86 additions and 54 deletions

View File

@@ -180,3 +180,24 @@ export const handleEditItems = async (
return { success: false };
}
};
export const changeSafeState = async (itemId: number) => {
try {
const response = await fetch(
`http://localhost:8002/api/changeSafeState/${itemId}`,
{
method: "PUT",
headers: {
Authorization: `Bearer ${Cookies.get("token")}`,
},
}
);
if (!response.ok) {
throw new Error("Failed to change safe state");
}
return { success: true };
} catch (error) {
console.error("Error changing safe state:", error);
return { success: false };
}
};