Refactor zone-related API calls to use zoneUuid instead of zoneId; update endpoint versions to V1; add authorization headers with tokens; improve error handling and logging

This commit is contained in:
2025-06-04 12:01:10 +05:30
109 changed files with 1391 additions and 807 deletions

View File

@@ -41,9 +41,8 @@ const SidePannel: React.FC<SidePannelProps> = ({ setActiveTab, activeTab }) => {
try {
const projectId = generateProjectId();
useSocketStore.getState().initializeSocket(email, organization, token);
console.log("projectId: ", projectId);
navigate(`/${projectId}`);
setLoadingProgress(1);
//API for creating new Project
// const project = await createProject(
// projectId,
@@ -60,6 +59,18 @@ const SidePannel: React.FC<SidePannelProps> = ({ setActiveTab, activeTab }) => {
};
console.log("projectSocket: ", projectSocket);
if (projectSocket) {
// console.log('addProject: ', addProject);
const handleResponse = (data: any) => {
console.log('Project add response:', data);
if (data.message === "Project created successfully") {
setLoadingProgress(1)
navigate(`/${data.data.projectId}`);
}
projectSocket.off("v1-project:response:add", handleResponse); // Clean up
};
projectSocket.on("v1-project:response:add", handleResponse);
console.log('addProject: ', addProject);
projectSocket.emit("v1:project:add", addProject);
} else {
console.error("Socket is not connected.");