Files
Dwinzo_Demo/app/src/services/factoryBuilder/camera/setCameraApi.ts

40 lines
940 B
TypeScript
Raw Normal View History

2025-06-10 15:28:23 +05:30
let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}`;
export const setCamera = async (
organization: string,
userId: string,
position: Object,
target: Object,
rotation: Object
) => {
try {
const response = await fetch(`${url_Backend_dwinzo}/api/v1/setCamera`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
organization,
userId,
position,
target,
rotation,
}),
});
if (!response.ok) {
throw new Error("Failed to set Camera Position and Target");
}
const result = await response.json();
return result;
} catch (error) {
echo.error("Failed to set camera");
if (error instanceof Error) {
2025-06-23 09:37:53 +05:30
console.log(error.message);
2025-06-10 15:28:23 +05:30
} else {
2025-06-23 09:37:53 +05:30
console.log("An unknown error occurred");
2025-06-10 15:28:23 +05:30
}
}
};