let url_Backend_dwinzoMajor = "http://192.168.0.110:3503"; export const createCamera = async (userId: string, position: Object) => { try { const response = await fetch( `${url_Backend_dwinzoMajor}/api/v1/createCamera`, { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ userId, position }), } ); if (!response.ok) { throw new Error("Failed to create Camera"); } const result = await response.json(); return result; } catch (error) { if (error instanceof Error) { throw new Error(error.message); } else { throw new Error("An unknown error occurred"); } } }; export const getCamera = async (userId: string) => { try { const response = await fetch( `${url_Backend_dwinzoMajor}/api/v1/getCamera/${userId}`, { method: "GET", headers: { "Content-Type": "application/json", }, } ); if (!response.ok) { throw new Error("Failed to get Camera"); } const result = await response.json(); return result; } catch (error) { if (error instanceof Error) { throw new Error(error.message); } else { throw new Error("An unknown error occurred"); } } };