2025-06-10 15:28:23 +05:30
|
|
|
let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}`;
|
|
|
|
|
|
|
|
|
|
export const deleteZonesApi = async (
|
|
|
|
|
userId: string,
|
|
|
|
|
organization: string,
|
|
|
|
|
zoneUuid: string
|
|
|
|
|
) => {
|
|
|
|
|
try {
|
|
|
|
|
const response = await fetch(`${url_Backend_dwinzo}/api/v1/setLine`, {
|
|
|
|
|
method: "POST",
|
|
|
|
|
headers: {
|
2025-06-24 15:38:05 +05:30
|
|
|
Authorization: "Bearer <access_token>",
|
2025-06-10 15:28:23 +05:30
|
|
|
"Content-Type": "application/json",
|
2025-06-24 15:38:05 +05:30
|
|
|
token: localStorage.getItem("token") || "",
|
|
|
|
|
refresh_token: localStorage.getItem("refreshToken") || "",
|
2025-06-10 15:28:23 +05:30
|
|
|
},
|
|
|
|
|
body: JSON.stringify({ userId, organization, zoneUuid }),
|
|
|
|
|
});
|
2025-06-24 15:38:05 +05:30
|
|
|
const newAccessToken = response.headers.get("x-access-token");
|
|
|
|
|
if (newAccessToken) {
|
|
|
|
|
//console.log("New token received:", newAccessToken);
|
|
|
|
|
localStorage.setItem("token", newAccessToken);
|
|
|
|
|
}
|
2025-06-10 15:28:23 +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 delete zone");
|
2025-06-10 15:28:23 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const result = await response.json();
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
} catch (error) {
|
|
|
|
|
echo.error("Failed to delete zone");
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|