Merge branch 'main-dev' into dev-refactor
This commit is contained in:
@@ -25,7 +25,7 @@ export const createAisleApi = async (
|
||||
}
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to add project");
|
||||
console.error("Failed to add project");
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
@@ -18,7 +18,7 @@ export const deleteAisleApi = async (aisleUuid: string, projectId: string, versi
|
||||
localStorage.setItem("token", newAccessToken);
|
||||
}
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to clearPanel in the zone");
|
||||
console.error("Failed to clearPanel in the zone");
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
@@ -22,7 +22,7 @@ export const getAisleApi = async (projectId: string, versionId: string) => {
|
||||
|
||||
// console.log("response: ", response);
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to fetch");
|
||||
console.error("Failed to fetch");
|
||||
}
|
||||
|
||||
return await response.json();
|
||||
|
||||
@@ -13,7 +13,7 @@ export const getAssetImages = async (cursor?: string) => {
|
||||
);
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to fetch assets");
|
||||
console.error("Failed to fetch assets");
|
||||
}
|
||||
|
||||
return await response.json();
|
||||
|
||||
@@ -13,7 +13,7 @@ export const getAssetModel = async (modelId: string) => {
|
||||
);
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to fetch model");
|
||||
console.error("Failed to fetch model");
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
@@ -26,7 +26,7 @@ export const deleteFloorItem = async (
|
||||
}
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to delete Floor Item");
|
||||
console.error("Failed to delete Floor Item");
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
@@ -22,7 +22,7 @@ export const getFloorAssets = async (organization: string, projectId?: string, v
|
||||
|
||||
// console.log('response: ', response);
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to get assets");
|
||||
console.error("Failed to get assets");
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
@@ -18,7 +18,7 @@ export const setAssetsApi = async (data: any) => {
|
||||
}
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to set or update Floor Item");
|
||||
console.error("Failed to set or update Floor Item");
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
@@ -26,7 +26,7 @@ export const deleteWallItem = async (
|
||||
}
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to delete Wall Item");
|
||||
console.error("Failed to delete Wall Item");
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
@@ -21,7 +21,7 @@ export const getWallItems = async (organization: string, projectId?: string, ver
|
||||
}
|
||||
// console.log('response: ', response);
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to get Wall Items");
|
||||
console.error("Failed to get Wall Items");
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
@@ -39,7 +39,7 @@ export const setWallItem = async (
|
||||
localStorage.setItem("token", newAccessToken);
|
||||
}
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to set or update Wall Item");
|
||||
console.error("Failed to set or update Wall Item");
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
@@ -21,7 +21,7 @@ export const getCamera = async (organization: string, userId: string, projectId?
|
||||
}
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to get Camera position and target");
|
||||
console.error("Failed to get Camera position and target");
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
@@ -31,7 +31,7 @@ export const setCamera = async (
|
||||
}
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to set Camera Position and Target");
|
||||
console.error("Failed to set Camera Position and Target");
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
@@ -21,11 +21,11 @@ export default async function getActiveUsersData(organization: string) {
|
||||
}
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`Error: ${response.status} - ${response.statusText}`);
|
||||
console.error(`Error: ${response.status} - ${response.statusText}`);
|
||||
}
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to get active cameras ");
|
||||
console.error("Failed to get active cameras ");
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
@@ -20,11 +20,11 @@ export default async function fetchShareUsers(organization: string) {
|
||||
localStorage.setItem("token", newAccessToken);
|
||||
}
|
||||
if (!response.ok) {
|
||||
throw new Error(`Error: ${response.status} - ${response.statusText}`);
|
||||
console.error(`Error: ${response.status} - ${response.statusText}`);
|
||||
}
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to get users ");
|
||||
console.error("Failed to get users ");
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
@@ -23,7 +23,7 @@ export default async function giveCollabAccess(
|
||||
}
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to set Camera Position and Target");
|
||||
console.error("Failed to set Camera Position and Target");
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
@@ -4,18 +4,20 @@ export const addCommentsApi = async (
|
||||
projectId: any,
|
||||
comment: string,
|
||||
threadId?: string,
|
||||
commentId?: string
|
||||
commentId?: string,
|
||||
versionId?: string
|
||||
) => {
|
||||
console.log(
|
||||
" projectId, comments, threadId: ",
|
||||
projectId,
|
||||
comment,
|
||||
threadId,
|
||||
commentId
|
||||
commentId,
|
||||
versionId
|
||||
);
|
||||
try {
|
||||
const response = await fetch(
|
||||
`${url_Backend_dwinzo}/api/v1/Thread/addComment`,
|
||||
`${url_Backend_dwinzo}/api/V1/Thread/addComment`,
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
@@ -33,9 +35,9 @@ export const addCommentsApi = async (
|
||||
//console.log("New token received:", newAccessToken);
|
||||
localStorage.setItem("token", newAccessToken);
|
||||
}
|
||||
console.log('response: ', response);
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to add project");
|
||||
console.error("Failed to add project");
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
@@ -44,9 +46,9 @@ export const addCommentsApi = async (
|
||||
return result;
|
||||
} catch (error) {
|
||||
if (error instanceof Error) {
|
||||
throw new Error(error.message);
|
||||
console.error(error.message);
|
||||
} else {
|
||||
throw new Error("An unknown error occurred");
|
||||
console.error("An unknown error occurred");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -5,10 +5,11 @@ export const createThreadApi = async (
|
||||
state: string,
|
||||
position: any,
|
||||
rotation: any,
|
||||
threadTitle: any
|
||||
threadTitle: any,
|
||||
versionId?: string
|
||||
) => {
|
||||
try {
|
||||
const response = await fetch(`${url_Backend_dwinzo}/api/v1/upsetThread`, {
|
||||
const response = await fetch(`${url_Backend_dwinzo}/api/V1/upsetThread`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
Authorization: "Bearer <access_token>",
|
||||
@@ -16,7 +17,14 @@ export const createThreadApi = async (
|
||||
token: localStorage.getItem("token") || "",
|
||||
refresh_token: localStorage.getItem("refreshToken") || "",
|
||||
},
|
||||
body: JSON.stringify({ projectId, state, position, rotation, threadTitle }),
|
||||
body: JSON.stringify({
|
||||
projectId,
|
||||
state,
|
||||
position,
|
||||
rotation,
|
||||
threadTitle,
|
||||
versionId,
|
||||
}),
|
||||
});
|
||||
const newAccessToken = response.headers.get("x-access-token");
|
||||
if (newAccessToken) {
|
||||
@@ -24,16 +32,16 @@ export const createThreadApi = async (
|
||||
localStorage.setItem("token", newAccessToken);
|
||||
}
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to add project");
|
||||
console.error("Failed to add project");
|
||||
}
|
||||
const result = await response.json();
|
||||
console.log('result: ', result);
|
||||
console.log("result: ", result);
|
||||
return result;
|
||||
} catch (error) {
|
||||
if (error instanceof Error) {
|
||||
throw new Error(error.message);
|
||||
console.error(error.message);
|
||||
} else {
|
||||
throw new Error("An unknown error occurred");
|
||||
console.error("An unknown error occurred");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -4,17 +4,19 @@ let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_UR
|
||||
export const deleteCommentApi = async (
|
||||
projectId: string,
|
||||
threadId: string,
|
||||
commentId: string
|
||||
commentId: string,
|
||||
versionId?: string
|
||||
) => {
|
||||
const body: any = {
|
||||
projectId,
|
||||
threadId,
|
||||
commentId,
|
||||
versionId,
|
||||
};
|
||||
|
||||
try {
|
||||
const response = await fetch(
|
||||
`${url_Backend_dwinzo}/api/v1/Thread/deleteComment`,
|
||||
`${url_Backend_dwinzo}/api/V1/Thread/deleteComment`,
|
||||
{
|
||||
method: "PATCH",
|
||||
headers: {
|
||||
@@ -32,16 +34,16 @@ export const deleteCommentApi = async (
|
||||
localStorage.setItem("token", newAccessToken);
|
||||
}
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to clearPanel in the zone");
|
||||
console.error("Failed to clearPanel in the zone");
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
return result;
|
||||
} catch (error) {
|
||||
if (error instanceof Error) {
|
||||
throw new Error(error.message);
|
||||
console.error(error.message);
|
||||
} else {
|
||||
throw new Error("An unknown error occurred");
|
||||
console.error("An unknown error occurred");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,14 +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 deleteThreadApi = async (projectId: string, threadId: string) => {
|
||||
export const deleteThreadApi = async (
|
||||
projectId: string,
|
||||
threadId: string,
|
||||
versionId: string
|
||||
) => {
|
||||
const body: any = {
|
||||
projectId,
|
||||
threadId,
|
||||
versionId,
|
||||
};
|
||||
|
||||
try {
|
||||
const response = await fetch(`${url_Backend_dwinzo}/api/v1/Thread/delete`, {
|
||||
const response = await fetch(`${url_Backend_dwinzo}/api/V1/Thread/delete`, {
|
||||
method: "PATCH",
|
||||
headers: {
|
||||
Authorization: "Bearer <access_token>",
|
||||
@@ -24,16 +29,16 @@ export const deleteThreadApi = async (projectId: string, threadId: string) => {
|
||||
localStorage.setItem("token", newAccessToken);
|
||||
}
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to clearPanel in the zone");
|
||||
console.error("Failed to clearPanel in the zone");
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
return result;
|
||||
} catch (error) {
|
||||
if (error instanceof Error) {
|
||||
throw new Error(error.message);
|
||||
console.error(error.message);
|
||||
} else {
|
||||
throw new Error("An unknown error occurred");
|
||||
console.error("An unknown error occurred");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -4,17 +4,19 @@ let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_UR
|
||||
export const editThreadTitleApi = async (
|
||||
projectId: string,
|
||||
threadId: string,
|
||||
threadTitle: string
|
||||
threadTitle: string,
|
||||
versionId?: string
|
||||
) => {
|
||||
const body: any = {
|
||||
projectId,
|
||||
threadId,
|
||||
threadTitle,
|
||||
versionId,
|
||||
};
|
||||
|
||||
try {
|
||||
const response = await fetch(
|
||||
`${url_Backend_dwinzo}/api/v1/Thread/updateTitle`,
|
||||
`${url_Backend_dwinzo}/api/V1/Thread/updateTitle`,
|
||||
{
|
||||
method: "PATCH",
|
||||
headers: {
|
||||
@@ -32,16 +34,16 @@ export const editThreadTitleApi = async (
|
||||
localStorage.setItem("token", newAccessToken);
|
||||
}
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to clearPanel in the zone");
|
||||
console.error("Failed to clearPanel in the zone");
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
return result;
|
||||
} catch (error) {
|
||||
if (error instanceof Error) {
|
||||
throw new Error(error.message);
|
||||
console.error(error.message);
|
||||
} else {
|
||||
throw new Error("An unknown error occurred");
|
||||
console.error("An unknown error occurred");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}`;
|
||||
|
||||
export const getAllThreads = async (projectId: string) => {
|
||||
export const getAllThreads = async (projectId: string, versionId: string) => {
|
||||
try {
|
||||
const response = await fetch(
|
||||
`${url_Backend_dwinzo}/api/v1/Threads/${projectId}`,
|
||||
`${url_Backend_dwinzo}/api/V1/Threads/${projectId}/${versionId}`,
|
||||
{
|
||||
method: "GET",
|
||||
headers: {
|
||||
@@ -21,19 +21,19 @@ export const getAllThreads = async (projectId: string) => {
|
||||
}
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to get assets");
|
||||
console.error("Failed to get assets");
|
||||
return;
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
// console.log('result: ', result);
|
||||
|
||||
return result;
|
||||
} catch (error) {
|
||||
echo.error("Failed to get floor asset");
|
||||
if (error instanceof Error) {
|
||||
throw new Error(error.message);
|
||||
console.error(error.message);
|
||||
} else {
|
||||
throw new Error("An unknown error occurred");
|
||||
console.error("An unknown error occurred");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -22,7 +22,7 @@ export const findEnvironment = async (organization: string, userId: string, proj
|
||||
}
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to get wall and roof visibility");
|
||||
console.error("Failed to get wall and roof visibility");
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
@@ -41,7 +41,7 @@ export const setEnvironment = async (
|
||||
}
|
||||
// console.log('responseenv: ', response);
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to set wall and roof visibility");
|
||||
console.error("Failed to set wall and roof visibility");
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
@@ -18,7 +18,7 @@ export const deleteLayer = async (organization: string, layer: number) => {
|
||||
localStorage.setItem("token", newAccessToken);
|
||||
}
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to delete line");
|
||||
console.error("Failed to delete line");
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
@@ -18,7 +18,7 @@ export const deleteLineApi = async (organization: string, line: Object) => {
|
||||
localStorage.setItem("token", newAccessToken);
|
||||
}
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to delete line");
|
||||
console.error("Failed to delete line");
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
@@ -19,7 +19,7 @@ export const deletePointApi = async (organization: string, uuid: string) => {
|
||||
}
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to delete point");
|
||||
console.error("Failed to delete point");
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
@@ -21,7 +21,7 @@ export const getLines = async (organization: string, projectId?: string, version
|
||||
}
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to get Lines");
|
||||
console.error("Failed to get Lines");
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
@@ -25,7 +25,7 @@ export const setLine = async (
|
||||
}
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to set line");
|
||||
console.error("Failed to set line");
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
@@ -22,7 +22,7 @@ export const updatePoint = async (
|
||||
localStorage.setItem("token", newAccessToken);
|
||||
}
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to update point");
|
||||
console.error("Failed to update point");
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
@@ -14,7 +14,7 @@ export const signUpApi = async (
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to signUpApi");
|
||||
console.error("Failed to signUpApi");
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
@@ -28,7 +28,7 @@ export const createVersionApi = async (projectId: string, createdBy: string, hie
|
||||
}
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to create Version History");
|
||||
console.error("Failed to create Version History");
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
@@ -21,7 +21,7 @@ export const getVersionDataApi = async (projectId: string, versionId: string) =>
|
||||
}
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to get Version Data");
|
||||
console.error("Failed to get Version Data");
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
@@ -21,7 +21,7 @@ export const getVersionHistoryApi = async (projectId: string, page?: number, lim
|
||||
}
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to get Version History");
|
||||
console.error("Failed to get Version History");
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
@@ -22,7 +22,7 @@ export const deleteZonesApi = async (
|
||||
localStorage.setItem("token", newAccessToken);
|
||||
}
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to delete zone");
|
||||
console.error("Failed to delete zone");
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
@@ -22,7 +22,7 @@ export const getZonesApi = async (organization: string, projectId?: string, vers
|
||||
}
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to get Zones");
|
||||
console.error("Failed to get Zones");
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
@@ -22,7 +22,7 @@ export const setZonesApi = async (
|
||||
localStorage.setItem("token", newAccessToken);
|
||||
}
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to set zone");
|
||||
console.error("Failed to set zone");
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
Reference in New Issue
Block a user