2025-06-23 09:37:53 +05:30
|
|
|
let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}`;
|
|
|
|
|
|
|
|
|
|
export const createThreadApi = async (
|
|
|
|
|
projectId: any,
|
|
|
|
|
state: string,
|
|
|
|
|
position: any,
|
|
|
|
|
rotation: any,
|
2025-06-24 12:21:12 +05:30
|
|
|
threadTitle: any,
|
|
|
|
|
versionId?: string
|
2025-06-23 09:37:53 +05:30
|
|
|
) => {
|
|
|
|
|
try {
|
|
|
|
|
const response = await fetch(`${url_Backend_dwinzo}/api/v1/upsetThread`, {
|
|
|
|
|
method: "POST",
|
|
|
|
|
headers: {
|
|
|
|
|
Authorization: "Bearer <access_token>",
|
|
|
|
|
"Content-Type": "application/json",
|
|
|
|
|
token: localStorage.getItem("token") || "",
|
|
|
|
|
refresh_token: localStorage.getItem("refreshToken") || "",
|
|
|
|
|
},
|
2025-06-24 12:21:12 +05:30
|
|
|
body: JSON.stringify({
|
|
|
|
|
projectId,
|
|
|
|
|
state,
|
|
|
|
|
position,
|
|
|
|
|
rotation,
|
|
|
|
|
threadTitle,
|
|
|
|
|
versionId,
|
|
|
|
|
}),
|
2025-06-23 09:37:53 +05:30
|
|
|
});
|
|
|
|
|
if (!response.ok) {
|
Refactor error handling in API services to use console.error instead of throwing errors
- Updated various API service files to replace error throwing with console.error for better logging.
- This change affects services related to aisles, assets, cameras, collaboration, comments, environment, lines, marketplace, simulation, visualization, and zones.
- The modifications aim to improve error handling by logging errors to the console instead of interrupting the flow with thrown errors.
2025-06-24 09:31:45 +05:30
|
|
|
console.error("Failed to add project");
|
2025-06-23 09:37:53 +05:30
|
|
|
}
|
|
|
|
|
const result = await response.json();
|
2025-06-24 12:21:12 +05:30
|
|
|
console.log("result: ", result);
|
2025-06-23 09:37:53 +05:30
|
|
|
return result;
|
|
|
|
|
} catch (error) {
|
|
|
|
|
if (error instanceof Error) {
|
Refactor error handling in API services to use console.error instead of throwing errors
- Updated various API service files to replace error throwing with console.error for better logging.
- This change affects services related to aisles, assets, cameras, collaboration, comments, environment, lines, marketplace, simulation, visualization, and zones.
- The modifications aim to improve error handling by logging errors to the console instead of interrupting the flow with thrown errors.
2025-06-24 09:31:45 +05:30
|
|
|
console.error(error.message);
|
2025-06-23 09:37:53 +05:30
|
|
|
} else {
|
Refactor error handling in API services to use console.error instead of throwing errors
- Updated various API service files to replace error throwing with console.error for better logging.
- This change affects services related to aisles, assets, cameras, collaboration, comments, environment, lines, marketplace, simulation, visualization, and zones.
- The modifications aim to improve error handling by logging errors to the console instead of interrupting the flow with thrown errors.
2025-06-24 09:31:45 +05:30
|
|
|
console.error("An unknown error occurred");
|
2025-06-23 09:37:53 +05:30
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|