updated api and socket for builder and visualization

This commit is contained in:
2025-06-04 11:55:59 +05:30
parent 44b6b4daab
commit 0d98892dff
109 changed files with 1382 additions and 788 deletions

View File

@@ -13,14 +13,12 @@ export const createProject = async (projectUuid: string, userId: string, thumbna
},
body: JSON.stringify({ projectUuid, userId, thumbnail, organization, }),
});
console.log('response: ', response);
if (!response.ok) {
throw new Error("Failed to add project");
}
const result = await response.json();
console.log('result: ', result);
return result;
} catch (error) {
if (error instanceof Error) {

View File

@@ -1,17 +1,21 @@
let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}`;
export const getFloorAssets = async (organization: string) => {
export const getFloorAssets = async (organization: string,projectId?:string) => {
try {
const response = await fetch(
`${url_Backend_dwinzo}/api/v2/floorAssets/${organization}`,
`${url_Backend_dwinzo}/api/V1/floorAssets/${projectId}`,
{
method: "GET",
headers: {
Authorization: "Bearer <access_token>", // Replace with actual token
"Content-Type": "application/json",
token: localStorage.getItem("token") || "", // Coerce null to empty string
refresh_token: localStorage.getItem("refreshToken") || "",
},
}
);
// console.log('response: ', response);
if (!response.ok) {
throw new Error("Failed to get assets");
}

View File

@@ -21,10 +21,13 @@ export const setFloorItemApi = async (
isVisible,
};
const response = await fetch(`${url_Backend_dwinzo}/api/v2/setasset`, {
const response = await fetch(`${url_Backend_dwinzo}/api/V1/setAsset`, {
method: "POST",
headers: {
Authorization: "Bearer <access_token>", // Replace with actual token
"Content-Type": "application/json",
token: localStorage.getItem("token") || "", // Coerce null to empty string
refresh_token: localStorage.getItem("refreshToken") || "",
},
body: JSON.stringify(body),
});

View File

@@ -1,22 +1,27 @@
let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}`;
export const getWallItems = async (organization: string) => {
export const getWallItems = async (organization: string,projectId?:string) => {
try {
const response = await fetch(
`${url_Backend_dwinzo}/api/v1/findWallItems/${organization}`,
`${url_Backend_dwinzo}/api/V1/walls/${projectId}`,
{
method: "GET",
headers: {
Authorization: "Bearer <access_token>", // Replace with actual token
"Content-Type": "application/json",
token: localStorage.getItem("token") || "", // Coerce null to empty string
refresh_token: localStorage.getItem("refreshToken") || "",
},
}
);
// console.log('response: ', response);
if (!response.ok) {
throw new Error("Failed to get Wall Items");
}
const result = await response.json();
// console.log('result: ', result);
return result;
} catch (error) {
echo.error("Failed to get wall items");

View File

@@ -3,23 +3,28 @@ import * as THREE from "three";
let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}`;
export const getCamera = async (organization: string, userId: string) => {
export const getCamera = async (organization: string, userId: string,projectId?:string) => {
try {
const response = await fetch(
`${url_Backend_dwinzo}/api/v1/getCamera/${organization}/${userId}`,
`${url_Backend_dwinzo}/api/V1/cameras/${projectId}`,
{
method: "GET",
headers: {
Authorization: "Bearer <access_token>", // Replace with actual token
"Content-Type": "application/json",
token: localStorage.getItem("token") || "", // Coerce null to empty string
refresh_token: localStorage.getItem("refreshToken") || "",
},
}
);
if (!response.ok) {
throw new Error("Failed to get Camera position and target");
}
// console.log('response: ', response);
// if (!response.ok) {
// throw new Error("Failed to get Camera position and target");
// }
const result = await response.json();
// console.log('result: ', result);
if (result === "user not found") {
return null;
} else {

View File

@@ -2,23 +2,28 @@ import { setEnvironment } from "./setEnvironment";
let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}`;
export const findEnvironment = async (organization: string, userId: string) => {
export const findEnvironment = async (organization: string, userId: string, projectId?: string) => {
try {
const response = await fetch(
`${url_Backend_dwinzo}/api/v1/findEnvironments/${organization}/${userId}`,
`${url_Backend_dwinzo}/api/V1/Environments/${projectId}`,
{
method: "GET",
headers: {
Authorization: "Bearer <access_token>", // Replace with actual token
"Content-Type": "application/json",
token: localStorage.getItem("token") || "", // Coerce null to empty string
refresh_token: localStorage.getItem("refreshToken") || "",
},
}
);
if (!response.ok) {
throw new Error("Failed to get wall and roof visibility");
}
const result = await response.json();
console.log('resultgetenv: ', result);
if (result === "user not found") {
const userpos = setEnvironment(
organization,
@@ -27,7 +32,8 @@ export const findEnvironment = async (organization: string, userId: string) => {
false,
false,
40,
true
true,
projectId
);
return userpos;
} else {

View File

@@ -7,15 +7,26 @@ export const setEnvironment = async (
roofVisibility: Boolean,
shadowVisibility: Boolean,
renderDistance: number,
limitDistance: boolean
limitDistance: boolean,
projectId?: string
) => {
console.log('organization,userId,wallVisibility,roofVisibility,shadowVisibility,renderDistance,limitDistance,: ', organization,
userId,
wallVisibility,
roofVisibility,
shadowVisibility,
renderDistance,
limitDistance,projectId);
try {
const response = await fetch(
`${url_Backend_dwinzo}/api/v1/setEvironments`,
`${url_Backend_dwinzo}/api/V1/SetEnvironments`,
{
method: "POST",
headers: {
Authorization: "Bearer <access_token>", // Replace with actual token
"Content-Type": "application/json",
token: localStorage.getItem("token") || "", // Coerce null to empty string
refresh_token: localStorage.getItem("refreshToken") || "",
},
body: JSON.stringify({
organization,
@@ -25,15 +36,19 @@ export const setEnvironment = async (
shadowVisibility,
renderDistance,
limitDistance,
projectId
}),
}
);
// console.log('responseenv: ', response);
if (!response.ok) {
throw new Error("Failed to set wall and roof visibility");
}
const result = await response.json();
console.log('resultsetenv: ', result);
return result;
} catch (error) {
echo.error("Failed to set env");

View File

@@ -1,13 +1,16 @@
let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}`;
export const getLines = async (organization: string) => {
export const getLines = async (organization: string,projectId?:string) => {
try {
const response = await fetch(
`${url_Backend_dwinzo}/api/v1/findLines/${organization}`,
`${url_Backend_dwinzo}/api/V1/lines/${projectId}`,
{
method: "GET",
headers: {
Authorization: "Bearer <access_token>", // Replace with actual token
"Content-Type": "application/json",
token: localStorage.getItem("token") || "", // Coerce null to empty string
refresh_token: localStorage.getItem("refreshToken") || "",
},
}
);
@@ -17,6 +20,7 @@ export const getLines = async (organization: string) => {
}
const result = await response.json();
// console.log('result: ', result);
return result;
} catch (error) {
echo.error("Failed to get Lines");

View File

@@ -3,7 +3,7 @@ let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_UR
export const deleteZonesApi = async (
userId: string,
organization: string,
zoneId: string
zoneUuid: string
) => {
try {
const response = await fetch(`${url_Backend_dwinzo}/api/v1/setLine`, {
@@ -11,7 +11,7 @@ export const deleteZonesApi = async (
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({ userId, organization, zoneId }),
body: JSON.stringify({ userId, organization, zoneUuid }),
});
if (!response.ok) {

View File

@@ -1,23 +1,27 @@
let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}`;
// let url_Backend_dwinzo = `http://192.168.0.102:5000`;
export const getZonesApi = async (organization: string) => {
export const getZonesApi = async (organization: string, projectId?: string) => {
try {
const response = await fetch(
`${url_Backend_dwinzo}/api/v2/findZones/${organization}`,
`${url_Backend_dwinzo}/api/V1/zones/${projectId}`,
{
method: "GET",
headers: {
Authorization: "Bearer <access_token>", // Replace with actual token
"Content-Type": "application/json",
token: localStorage.getItem("token") || "", // Coerce null to empty string
refresh_token: localStorage.getItem("refreshToken") || "",
},
}
);
// if (!response.ok) {
// throw new Error("Failed to get Zones");
// }
if (!response.ok) {
throw new Error("Failed to get Zones");
}
const result = await response.json();
return result;
} catch (error) {
echo.error("Failed to get zone data");

View File

@@ -1,17 +1,20 @@
let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}`;
// let url_Backend_dwinzo = `http://192.168.0.102:5000`;
export const adding3dWidgets = async (
zoneId: string,
zoneUuid: string,
organization: string,
widget: {}
) => {
try {
const response = await fetch(`${url_Backend_dwinzo}/api/v2/3dwidget/save`, {
const response = await fetch(`${url_Backend_dwinzo}/api/V1/widget3d/save`, {
method: "POST",
headers: {
Authorization: "Bearer <access_token>", // Replace with actual token
"Content-Type": "application/json",
token: localStorage.getItem("token") || "", // Coerce null to empty string
refresh_token: localStorage.getItem("refreshToken") || "",
},
body: JSON.stringify({ organization, zoneId, widget }),
body: JSON.stringify({ organization, zoneUuid, widget }),
});
if (!response.ok) {

View File

@@ -2,19 +2,22 @@ let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_UR
// let url_Backend_dwinzo = `http://192.168.0.102:5000`;
export const addingFloatingWidgets = async (
zoneId: string,
zoneUuid: string,
organization: string,
widget: {}
) => {
try {
const response = await fetch(
`${url_Backend_dwinzo}/api/v2/floatwidget/save`,
`${url_Backend_dwinzo}/api/V1/floatWidget/save`,
{
method: "POST",
headers: {
Authorization: "Bearer <access_token>", // Replace with actual token
"Content-Type": "application/json",
token: localStorage.getItem("token") || "", // Coerce null to empty string
refresh_token: localStorage.getItem("refreshToken") || "",
},
body: JSON.stringify({ organization, zoneId, widget }),
body: JSON.stringify({ organization, zoneUuid, widget }),
}
);

View File

@@ -1,17 +1,20 @@
let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}`;
// let url_Backend_dwinzo = `http://192.168.0.102:5000`;
export const addingWidgets = async (
zoneId: string,
zoneUuid: string,
organization: string,
widget: {}
) => {
try {
const response = await fetch(`${url_Backend_dwinzo}/api/v2/widget/save`, {
const response = await fetch(`${url_Backend_dwinzo}/api/V1/widget/save`, {
method: "POST",
headers: {
Authorization: "Bearer <access_token>", // Replace with actual token
"Content-Type": "application/json",
token: localStorage.getItem("token") || "", // Coerce null to empty string
refresh_token: localStorage.getItem("refreshToken") || "",
},
body: JSON.stringify({ organization, zoneId, widget }),
body: JSON.stringify({ organization, zoneUuid, widget }),
});
if (!response.ok) {
@@ -19,6 +22,7 @@ export const addingWidgets = async (
}
const result = await response.json();
// console.log('result: ', result);
return result;
} catch (error) {
echo.error("Failed to add widget");

View File

@@ -1,17 +1,20 @@
let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}`;
// let url_Backend_dwinzo = `http://192.168.0.102:5000`;
export const clearPanel = async (
zoneId: string,
zoneUuid: string,
organization: string,
panelName: string
) => {
try {
const response = await fetch(`${url_Backend_dwinzo}/api/v2/clearpanel`, {
const response = await fetch(`${url_Backend_dwinzo}/api/V1/panel/clear`, {
method: "PATCH",
headers: {
Authorization: "Bearer <access_token>", // Replace with actual token
"Content-Type": "application/json",
token: localStorage.getItem("token") || "", // Coerce null to empty string
refresh_token: localStorage.getItem("refreshToken") || "",
},
body: JSON.stringify({ organization, zoneId, panelName }),
body: JSON.stringify({ organization, zoneUuid, panelName }),
});
if (!response.ok) {

View File

@@ -2,19 +2,22 @@ let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_UR
// let url_Backend_dwinzo = `http://192.168.0.102:5000`;
export const delete3dWidgetApi = async (
zoneId: string,
zoneUuid: string,
organization: string,
id: string
) => {
try {
const response = await fetch(
`${url_Backend_dwinzo}/api/v2/widget3D/delete`,
`${url_Backend_dwinzo}/api/V1/widget3d/delete`,
{
method: "PATCH",
headers: {
Authorization: "Bearer <access_token>", // Replace with actual token
"Content-Type": "application/json",
token: localStorage.getItem("token") || "", // Coerce null to empty string
refresh_token: localStorage.getItem("refreshToken") || "",
},
body: JSON.stringify({ organization, zoneId, id }),
body: JSON.stringify({ organization, zoneUuid, id }),
}
);

View File

@@ -7,11 +7,14 @@ export const deleteFloatingWidgetApi = async (
) => {
try {
const response = await fetch(
`${url_Backend_dwinzo}/api/v2/floatwidget/delete`,
`${url_Backend_dwinzo}/api/V1/floatWidget/delete`,
{
method: "PATCH",
headers: {
Authorization: "Bearer <access_token>", // Replace with actual token
"Content-Type": "application/json",
token: localStorage.getItem("token") || "", // Coerce null to empty string
refresh_token: localStorage.getItem("refreshToken") || "",
},
body: JSON.stringify({ organization, floatWidgetID }),
}

View File

@@ -2,17 +2,20 @@ let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_UR
// let url_Backend_dwinzo = `http://192.168.0.102:5000`;
export const deletePanelApi = async (
zoneId: string,
zoneUuid: string,
panelName: string,
organization: string
) => {
try {
const response = await fetch(`${url_Backend_dwinzo}/api/v2/panel/delete`, {
const response = await fetch(`${url_Backend_dwinzo}/api/V1/panel/delete`, {
method: "PATCH",
headers: {
Authorization: "Bearer <access_token>", // Replace with actual token
"Content-Type": "application/json",
token: localStorage.getItem("token") || "", // Coerce null to empty string
refresh_token: localStorage.getItem("refreshToken") || "",
},
body: JSON.stringify({ organization, zoneId, panelName }),
body: JSON.stringify({ organization, zoneUuid, panelName }),
});
if (!response.ok) {

View File

@@ -7,11 +7,14 @@ export const deleteTemplateApi = async (
) => {
try {
const response = await fetch(
`${url_Backend_dwinzo}/api/v2/TemplateDelete/${templateID}/${organization}`,
`${url_Backend_dwinzo}/api/V1/template/delete`,
{
method: "PATCH",
headers: {
Authorization: "Bearer <access_token>", // Replace with actual token
"Content-Type": "application/json",
token: localStorage.getItem("token") || "", // Coerce null to empty string
refresh_token: localStorage.getItem("refreshToken") || "",
},
}
);

View File

@@ -4,15 +4,18 @@ let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_UR
export const deleteWidgetApi = async (
widgetID: string,
organization: string,
zoneId: string
zoneUuid: string
) => {
try {
const response = await fetch(`${url_Backend_dwinzo}/api/v2/delete/widget`, {
const response = await fetch(`${url_Backend_dwinzo}/api/V1/widget/delete`, {
method: "PATCH",
headers: {
Authorization: "Bearer <access_token>", // Replace with actual token
"Content-Type": "application/json",
token: localStorage.getItem("token") || "", // Coerce null to empty string
refresh_token: localStorage.getItem("refreshToken") || "",
},
body: JSON.stringify({ organization, widgetID, zoneId }),
body: JSON.stringify({ organization, widgetID, zoneUuid }),
});
if (!response.ok) {

View File

@@ -1,17 +1,20 @@
let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}`;
// let url_Backend_dwinzo = `http://192.168.0.102:5000`;
export const duplicateWidgetApi = async (
zoneId: string,
zoneUuid: string,
organization: string,
widget: {}
) => {
try {
const response = await fetch(`${url_Backend_dwinzo}/api/v2/widget/save`, {
const response = await fetch(`${url_Backend_dwinzo}/api/V1/widget/save`, {
method: "POST",
headers: {
Authorization: "Bearer <access_token>", // Replace with actual token
"Content-Type": "application/json",
token: localStorage.getItem("token") || "", // Coerce null to empty string
refresh_token: localStorage.getItem("refreshToken") || "",
},
body: JSON.stringify({ organization, zoneId, widget }),
body: JSON.stringify({ organization, zoneUuid, widget }),
});
if (!response.ok) {

View File

@@ -1,16 +1,22 @@
import { projectTutorial } from "../../dashboard/projectTutorial";
let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}`;
// let url_Backend_dwinzo = `http://192.168.0.102:5000`;
export const get3dWidgetZoneData = async (
ZoneId?: string,
organization?: string
zoneUuid?: string,
organization?: string,
projectId?: string
) => {
try {
const response = await fetch(
`${url_Backend_dwinzo}/api/v2/3dwidgetData/${ZoneId}/${organization}`,
`${url_Backend_dwinzo}/api/V1/widget3d/data/${zoneUuid}/${projectId}`,
{
method: "GET",
headers: {
Authorization: "Bearer <access_token>", // Replace with actual token
"Content-Type": "application/json",
token: localStorage.getItem("token") || "", // Coerce null to empty string
refresh_token: localStorage.getItem("refreshToken") || "",
},
}
);

View File

@@ -1,16 +1,20 @@
let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}`;
// let url_Backend_dwinzo = `http://192.168.0.102:5000`;
export const getFloatingZoneData = async (
ZoneId?: string,
organization?: string
zoneUuid?: string,
organization?: string,
projectId?: string
) => {
try {
const response = await fetch(
`${url_Backend_dwinzo}/api/v2/floadData/${ZoneId}/${organization}`,
`${url_Backend_dwinzo}/api/V1/floatWidgets/${zoneUuid}/${projectId}`,
{
method: "GET",
headers: {
Authorization: "Bearer <access_token>", // Replace with actual token
"Content-Type": "application/json",
token: localStorage.getItem("token") || "", // Coerce null to empty string
refresh_token: localStorage.getItem("refreshToken") || "",
},
}
);

View File

@@ -1,17 +1,17 @@
let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}`;
// let url_Backend_dwinzo = `http://192.168.0.102:5000`;
export const getSelect2dZoneData = async (
ZoneId?: string,
organization?: string
) => {
export const getSelect2dZoneData = async (zoneUuid?: string, organization?: string, projectId?: string) => {
try {
const response = await fetch(
`${url_Backend_dwinzo}/api/v2/ZoneVisualization/${ZoneId}?organization=${organization}`,
`${url_Backend_dwinzo}/api/V1/zones/panel/${projectId}/${zoneUuid}`,
{
method: "GET",
headers: {
Authorization: "Bearer <access_token>", // Replace with actual token
"Content-Type": "application/json",
token: localStorage.getItem("token") || "", // Coerce null to empty string
refresh_token: localStorage.getItem("refreshToken") || "",
},
}
);

View File

@@ -1,13 +1,16 @@
let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}`;
// let url_Backend_dwinzo = `http://192.168.0.102:5000`;
export const getTemplateData = async (organization?: string) => {
export const getTemplateData = async (organization?: string, projectId?: string) => {
try {
const response = await fetch(
`${url_Backend_dwinzo}/api/v2/templateData/${organization}`,
`${url_Backend_dwinzo}/api/V1/template/data/${projectId}`,
{
method: "GET",
headers: {
Authorization: "Bearer <access_token>", // Replace with actual token
"Content-Type": "application/json",
token: localStorage.getItem("token") || "", // Coerce null to empty string
refresh_token: localStorage.getItem("refreshToken") || "",
},
}
);

View File

@@ -1,17 +1,19 @@
let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}`;
// let url_Backend_dwinzo = `http://192.168.0.102:5000`;
export const getZone2dData = async (organization?: string) => {
export const getZone2dData = async (organization?: string, projectId?: string) => {
try {
const response = await fetch(
`${url_Backend_dwinzo}/api/v2/pageZodeData?organization=${organization}`,
`${url_Backend_dwinzo}/api/V1/zones/visualization/${projectId}`,
{
method: "GET",
headers: {
Authorization: "Bearer <access_token>", // Replace with actual token
"Content-Type": "application/json",
token: localStorage.getItem("token") || "", // Coerce null to empty string
refresh_token: localStorage.getItem("refreshToken") || "",
},
}
);
if (!response.ok) {
throw new Error("Failed to fetch zoneDatas");
}

View File

@@ -1,14 +1,17 @@
let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}`;
// let url_Backend_dwinzo = `http://192.168.0.102:5000`;
export const getZoneData = async (zoneId: string, organization: string) => {
export const getZoneData = async (zoneUuid: string, organization: string, projectId?: string) => {
try {
const response = await fetch(
`${url_Backend_dwinzo}/api/v2/A_zone/${zoneId}/${organization}`,
`${url_Backend_dwinzo}/api/V1/zones/${projectId}/${zoneUuid}`,
{
method: "GET",
headers: {
Authorization: "Bearer <access_token>", // Replace with actual token
"Content-Type": "application/json",
token: localStorage.getItem("token") || "", // Coerce null to empty string
refresh_token: localStorage.getItem("refreshToken") || "",
},
}
);

View File

@@ -2,18 +2,21 @@ let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_UR
// let url_Backend_dwinzo = `http://192.168.0.102:5000`;
export const loadTempleteApi = async (
templateID: string,
zoneId: string,
zoneUuid: string,
organization: string
) => {
try {
const response = await fetch(
`${url_Backend_dwinzo}/api/v2/TemplatetoZone`,
`${url_Backend_dwinzo}/api/V1/template/toZone`,
{
method: "POST",
headers: {
Authorization: "Bearer <access_token>", // Replace with actual token
"Content-Type": "application/json",
token: localStorage.getItem("token") || "", // Coerce null to empty string
refresh_token: localStorage.getItem("refreshToken") || "",
},
body: JSON.stringify({ organization, zoneId, templateID }),
body: JSON.stringify({ organization, zoneUuid, templateID }),
}
);

View File

@@ -1,7 +1,7 @@
let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}`;
// let url_Backend_dwinzo = `http://192.168.0.102:5000`;
export const lockPanel = async (
zoneId: string,
zoneUuid: string,
organization: string,
lockedPanel: any
) => {
@@ -13,7 +13,7 @@ export const lockPanel = async (
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({ organization, zoneId, lockedPanel }),
body: JSON.stringify({ organization, zoneUuid, lockedPanel }),
}
);

View File

@@ -3,16 +3,19 @@ type Side = "top" | "bottom" | "left" | "right";
export const panelData = async (
organization: string,
zoneId: string,
zoneUuid: string,
panelOrder: Side[]
) => {
try {
const response = await fetch(`${url_Backend_dwinzo}/api/v2/panel/save`, {
const response = await fetch(`${url_Backend_dwinzo}/api/V1/panel/save`, {
method: "POST",
headers: {
Authorization: "Bearer <access_token>", // Replace with actual token
"Content-Type": "application/json",
token: localStorage.getItem("token") || "", // Coerce null to empty string
refresh_token: localStorage.getItem("refreshToken") || "",
},
body: JSON.stringify({ organization, zoneId, panelOrder }),
body: JSON.stringify({ organization, zoneUuid, panelOrder }),
});
if (!response.ok) {

View File

@@ -2,10 +2,13 @@ let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_UR
// let url_Backend_dwinzo = `http://192.168.0.102:5000`;
export const saveTemplateApi = async (organization: string, template: {}) => {
try {
const response = await fetch(`${url_Backend_dwinzo}/api/v2/template/save`, {
const response = await fetch(`${url_Backend_dwinzo}/api/V1/template/save`, {
method: "POST",
headers: {
Authorization: "Bearer <access_token>", // Replace with actual token
"Content-Type": "application/json",
token: localStorage.getItem("token") || "", // Coerce null to empty string
refresh_token: localStorage.getItem("refreshToken") || "",
},
body: JSON.stringify({ organization, template }),
});

View File

@@ -1,22 +1,27 @@
let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}`;
// let url_Backend_dwinzo = `http://192.168.0.102:5000`;
export const update3dWidget = async (
zoneId: string,
zoneUuid: string,
organization: string,
id: string,
position?: [number, number, number]
) => {
console.log("organization: ", organization);
console.log("zoneId: ", zoneId);
console.log("zoneUuid: ", zoneUuid);
try {
const response = await fetch(
`${url_Backend_dwinzo}/api/v2/modifyPR/widget3D`,
`${url_Backend_dwinzo}/api/V1/widget3d/update`,
{
method: "PATCH",
headers: { "Content-Type": "application/json" },
headers: {
Authorization: "Bearer <access_token>", // Replace with actual token
"Content-Type": "application/json",
token: localStorage.getItem("token") || "", // Coerce null to empty string
refresh_token: localStorage.getItem("refreshToken") || "",
},
body: JSON.stringify({
organization,
zoneId,
zoneUuid,
id,
position,
}),
@@ -40,24 +45,27 @@ export const update3dWidget = async (
};
export const update3dWidgetRotation = async (
zoneId: string,
zoneUuid: string,
organization: string,
id: string,
rotation?: [number, number, number]
) => {
console.log("organization: ", organization);
console.log("zoneId: ", zoneId);
console.log("zoneUuid: ", zoneUuid);
try {
const response = await fetch(
`${url_Backend_dwinzo}/api/v2/modifyPR/widget3D`,
`${url_Backend_dwinzo}/api/V1/widget3d/update`,
{
method: "PATCH",
headers: {
Authorization: "Bearer <access_token>", // Replace with actual token
"Content-Type": "application/json",
token: localStorage.getItem("token") || "", // Coerce null to empty string
refresh_token: localStorage.getItem("refreshToken") || "",
},
body: JSON.stringify({
organization,
zoneId,
zoneUuid,
id,
rotation,
}),

View File

@@ -3,10 +3,13 @@ let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_UR
export const zoneCameraUpdate = async (zonesdata: {}, organization: string) => {
try {
const response = await fetch(`${url_Backend_dwinzo}/api/v2/zone/save`, {
const response = await fetch(`${url_Backend_dwinzo}/api/V1/zones`, {
method: "POST",
headers: {
headers: {
Authorization: "Bearer <access_token>", // Replace with actual token
"Content-Type": "application/json",
token: localStorage.getItem("token") || "", // Coerce null to empty string
refresh_token: localStorage.getItem("refreshToken") || "",
},
body: JSON.stringify({ zonesdata, organization }),
});