Update zoneCameraUpdate function to include projectId and enhance logging
This commit is contained in:
parent
0bf82c1a73
commit
2397de99b4
|
@ -9,6 +9,7 @@ import {
|
||||||
usezoneTarget,
|
usezoneTarget,
|
||||||
} from "../../../../store/builder/store";
|
} from "../../../../store/builder/store";
|
||||||
import { zoneCameraUpdate } from "../../../../services/visulization/zone/zoneCameraUpdation";
|
import { zoneCameraUpdate } from "../../../../services/visulization/zone/zoneCameraUpdation";
|
||||||
|
import { useParams } from "react-router-dom";
|
||||||
|
|
||||||
const ZoneProperties: React.FC = () => {
|
const ZoneProperties: React.FC = () => {
|
||||||
const { Edit, setEdit } = useEditPosition();
|
const { Edit, setEdit } = useEditPosition();
|
||||||
|
@ -16,6 +17,7 @@ const ZoneProperties: React.FC = () => {
|
||||||
const { zonePosition, setZonePosition } = usezonePosition();
|
const { zonePosition, setZonePosition } = usezonePosition();
|
||||||
const { zoneTarget, setZoneTarget } = usezoneTarget();
|
const { zoneTarget, setZoneTarget } = usezoneTarget();
|
||||||
const { zones, setZones } = useZones();
|
const { zones, setZones } = useZones();
|
||||||
|
const { projectId } = useParams()
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setZonePosition(selectedZone.zoneViewPortPosition);
|
setZonePosition(selectedZone.zoneViewPortPosition);
|
||||||
|
@ -33,7 +35,8 @@ const ZoneProperties: React.FC = () => {
|
||||||
viewPortCenter: zoneTarget,
|
viewPortCenter: zoneTarget,
|
||||||
};
|
};
|
||||||
|
|
||||||
let response = await zoneCameraUpdate(zonesdata, organization);
|
let response = await zoneCameraUpdate(zonesdata, organization,projectId);
|
||||||
|
console.log('response: ', response);
|
||||||
if (response.message === "updated successfully") {
|
if (response.message === "updated successfully") {
|
||||||
setEdit(false);
|
setEdit(false);
|
||||||
} else {
|
} else {
|
||||||
|
@ -56,7 +59,8 @@ const ZoneProperties: React.FC = () => {
|
||||||
zoneName: newName,
|
zoneName: newName,
|
||||||
};
|
};
|
||||||
// Call your API to update the zone
|
// Call your API to update the zone
|
||||||
let response = await zoneCameraUpdate(zonesdata, organization);
|
let response = await zoneCameraUpdate(zonesdata, organization,projectId);
|
||||||
|
console.log('response: ', response);
|
||||||
// console.log("response: ", response);
|
// console.log("response: ", response);
|
||||||
if (response.message === "updated successfully") {
|
if (response.message === "updated successfully") {
|
||||||
setZones((prevZones: any[]) =>
|
setZones((prevZones: any[]) =>
|
||||||
|
|
|
@ -125,7 +125,8 @@ const List: React.FC<ListProps> = ({ items = [], remove }) => {
|
||||||
zoneName: newName,
|
zoneName: newName,
|
||||||
};
|
};
|
||||||
|
|
||||||
const response = await zoneCameraUpdate(zonesdata, organization);
|
const response = await zoneCameraUpdate(zonesdata, organization,projectId);
|
||||||
|
console.log('response: ', response);
|
||||||
if (response.message === "updated successfully") {
|
if (response.message === "updated successfully") {
|
||||||
setSelectedZone((prev) => ({ ...prev, zoneName: newName }));
|
setSelectedZone((prev) => ({ ...prev, zoneName: newName }));
|
||||||
|
|
||||||
|
|
|
@ -467,7 +467,7 @@ async function handleModelLoad(
|
||||||
userId: userId,
|
userId: userId,
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log('data: ', data);
|
// console.log('data: ', data);
|
||||||
socket.emit("v1:model-asset:add", data);
|
socket.emit("v1:model-asset:add", data);
|
||||||
|
|
||||||
const asset = {
|
const asset = {
|
||||||
|
|
|
@ -45,7 +45,7 @@ function deletePoint(
|
||||||
userId
|
userId
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('data: ', data);
|
// console.log('data: ', data);
|
||||||
socket.emit('v1:Line:delete:point', data);
|
socket.emit('v1:Line:delete:point', data);
|
||||||
|
|
||||||
////////// Update onlyFloorlines.current to remove references to the deleted point //////////
|
////////// Update onlyFloorlines.current to remove references to the deleted point //////////
|
||||||
|
|
|
@ -82,7 +82,7 @@ const ZoneGroup: React.FC = () => {
|
||||||
|
|
||||||
const organization = email.split("@")[1].split(".")[0];
|
const organization = email.split("@")[1].split(".")[0];
|
||||||
const data = await getZonesApi(organization, projectId);
|
const data = await getZonesApi(organization, projectId);
|
||||||
console.log('data: ', data);
|
// console.log('data: ', data);
|
||||||
|
|
||||||
if (data.length > 0) {
|
if (data.length > 0) {
|
||||||
const fetchedZones = data.map((zone: any) => ({
|
const fetchedZones = data.map((zone: any) => ({
|
||||||
|
|
|
@ -144,7 +144,7 @@ const CamModelsGroup = () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.on("v1:camera:Response:update", (data: any) => {
|
socket.on("v1:camera:Response:update", (data: any) => {
|
||||||
console.log('data: ', data);
|
// console.log('data: ', data);
|
||||||
if (
|
if (
|
||||||
!groupRef.current ||
|
!groupRef.current ||
|
||||||
socket.id === data.socketId ||
|
socket.id === data.socketId ||
|
||||||
|
|
|
@ -173,7 +173,7 @@ export default function SocketResponses({
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.on("v1:Line:response:update", (data: any) => {
|
socket.on("v1:Line:response:update", (data: any) => {
|
||||||
console.log('data: ', data);
|
// console.log('data: ', data);
|
||||||
if (socket.id === data.socketId) {
|
if (socket.id === data.socketId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -215,7 +215,7 @@ export default function SocketResponses({
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.on("v1:Line:response:delete", (data: any) => {
|
socket.on("v1:Line:response:delete", (data: any) => {
|
||||||
console.log('data: ', data);
|
// console.log('data: ', data);
|
||||||
if (socket.id === data.socketId) {
|
if (socket.id === data.socketId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -338,7 +338,7 @@ export default function SocketResponses({
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.on("v1:Line:response:delete:layer", async (data: any) => {
|
socket.on("v1:Line:response:delete:layer", async (data: any) => {
|
||||||
console.log('data: ', data);
|
// console.log('data: ', data);
|
||||||
if (socket.id === data.socketId) {
|
if (socket.id === data.socketId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -670,7 +670,7 @@ export default function SocketResponses({
|
||||||
const organization = email!.split("@")[1].split(".")[0];
|
const organization = email!.split("@")[1].split(".")[0];
|
||||||
|
|
||||||
socket.on("v1:Line:response:create", async (data: any) => {
|
socket.on("v1:Line:response:create", async (data: any) => {
|
||||||
console.log('data: ', data);
|
// console.log('data: ', data);
|
||||||
//
|
//
|
||||||
if (socket.id === data.socketId) {
|
if (socket.id === data.socketId) {
|
||||||
return;
|
return;
|
||||||
|
@ -789,7 +789,7 @@ export default function SocketResponses({
|
||||||
const organization = email!.split("@")[1].split(".")[0];
|
const organization = email!.split("@")[1].split(".")[0];
|
||||||
|
|
||||||
socket.on("v1:zone:response:updates", (data: any) => {
|
socket.on("v1:zone:response:updates", (data: any) => {
|
||||||
console.log('data: ', data);
|
// console.log('data: ', data);
|
||||||
if (socket.id === data.socketId) {
|
if (socket.id === data.socketId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -835,7 +835,7 @@ export default function SocketResponses({
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.on("v1:zone:response:delete", (data: any) => {
|
socket.on("v1:zone:response:delete", (data: any) => {
|
||||||
console.log('data: ', data);
|
// console.log('data: ', data);
|
||||||
if (socket.id === data.socketId) {
|
if (socket.id === data.socketId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -363,7 +363,7 @@ const CopyPasteControls = ({
|
||||||
projectId
|
projectId
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log('data: ', data);
|
// console.log('data: ', data);
|
||||||
socket.emit("v1:model-asset:add", data);
|
socket.emit("v1:model-asset:add", data);
|
||||||
|
|
||||||
obj.userData = {
|
obj.userData = {
|
||||||
|
@ -419,7 +419,7 @@ const CopyPasteControls = ({
|
||||||
userId
|
userId
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log('data: ', data);
|
// console.log('data: ', data);
|
||||||
socket.emit("v1:model-asset:add", data);
|
socket.emit("v1:model-asset:add", data);
|
||||||
|
|
||||||
const asset: Asset = {
|
const asset: Asset = {
|
||||||
|
|
|
@ -338,7 +338,7 @@ const DuplicationControls = ({
|
||||||
userId
|
userId
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log('data: ', data);
|
// console.log('data: ', data);
|
||||||
socket.emit("v1:model-asset:add", data);
|
socket.emit("v1:model-asset:add", data);
|
||||||
|
|
||||||
const asset: Asset = {
|
const asset: Asset = {
|
||||||
|
@ -388,7 +388,7 @@ const DuplicationControls = ({
|
||||||
projectId
|
projectId
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log('data: ', data);
|
// console.log('data: ', data);/
|
||||||
socket.emit("v1:model-asset:add", data);
|
socket.emit("v1:model-asset:add", data);
|
||||||
|
|
||||||
const asset: Asset = {
|
const asset: Asset = {
|
||||||
|
|
|
@ -318,7 +318,7 @@ function MoveControls({
|
||||||
userId
|
userId
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log('data: ', data);
|
// console.log('data: ', data);
|
||||||
socket.emit("v1:model-asset:add", data);
|
socket.emit("v1:model-asset:add", data);
|
||||||
|
|
||||||
AssetGroup.current.add(obj);
|
AssetGroup.current.add(obj);
|
||||||
|
|
|
@ -273,7 +273,7 @@ function RotateControls({
|
||||||
userId
|
userId
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log('data: ', data);
|
// console.log('data: ', data);
|
||||||
socket.emit("v1:model-asset:add", data);
|
socket.emit("v1:model-asset:add", data);
|
||||||
|
|
||||||
AssetGroup.current.add(obj);
|
AssetGroup.current.add(obj);
|
||||||
|
|
|
@ -135,7 +135,7 @@ export default function TransformControl() {
|
||||||
projectId
|
projectId
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log('data: ', data);
|
// console.log('data: ', data);
|
||||||
socket.emit("v1:model-asset:add", data);
|
socket.emit("v1:model-asset:add", data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,20 @@
|
||||||
let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}`;
|
let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}`;
|
||||||
// let url_Backend_dwinzo = `http://192.168.0.102:5000`;
|
// let url_Backend_dwinzo = `http://192.168.0.102:5000`;
|
||||||
|
|
||||||
export const zoneCameraUpdate = async (zonesdata: {}, organization: string) => {
|
export const zoneCameraUpdate = async (zoneData: {}, organization: string, projectId?: string) => {
|
||||||
|
console.log('projectId: ', projectId);
|
||||||
|
console.log('organization: ', organization);
|
||||||
|
console.log('zonesdata: ', zoneData);
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`${url_Backend_dwinzo}/api/V1/zones`, {
|
const response = await fetch(`${url_Backend_dwinzo}/api/V1/zones`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: "Bearer <access_token>", // Replace with actual token
|
Authorization: "Bearer <access_token>", // Replace with actual token
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
token: localStorage.getItem("token") || "", // Coerce null to empty string
|
token: localStorage.getItem("token") || "", // Coerce null to empty string
|
||||||
refresh_token: localStorage.getItem("refreshToken") || "",
|
refresh_token: localStorage.getItem("refreshToken") || "",
|
||||||
},
|
},
|
||||||
body: JSON.stringify({ zonesdata, organization }),
|
body: JSON.stringify({ zoneData,projectId }),
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
|
|
Loading…
Reference in New Issue