- Deleted obsolete API files for wall items, layers, lines, and points. - Introduced new zone management APIs including create, delete, and update functionalities. - Enhanced zone state management in the store with new properties for height and color. - Implemented 2D and 3D zone rendering components for better visualization. - Added asset fetching functionalities for marketplace integration. - Updated types to accommodate new zone properties and API responses.
38 lines
1.2 KiB
TypeScript
38 lines
1.2 KiB
TypeScript
let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}`;
|
|
|
|
export const getZonesApi = async (
|
|
projectId: string,
|
|
versionId: string,
|
|
) => {
|
|
try {
|
|
const response = await fetch(`${url_Backend_dwinzo}/api/V2/zones/${projectId}/${versionId}`, {
|
|
method: "GET",
|
|
headers: {
|
|
Authorization: "Bearer <access_token>",
|
|
"Content-Type": "application/json",
|
|
token: localStorage.getItem("token") || "",
|
|
refresh_token: localStorage.getItem("refreshToken") || "",
|
|
},
|
|
});
|
|
|
|
const newAccessToken = response.headers.get("x-access-token");
|
|
if (newAccessToken) {
|
|
localStorage.setItem("token", newAccessToken);
|
|
}
|
|
|
|
if (!response.ok) {
|
|
console.error("Failed to get zones:", response.statusText);
|
|
}
|
|
|
|
const result = await response.json();
|
|
return result;
|
|
} catch (error) {
|
|
echo.error("Failed to get zones");
|
|
if (error instanceof Error) {
|
|
console.log(error.message);
|
|
} else {
|
|
console.log("An unknown error occurred");
|
|
}
|
|
}
|
|
};
|