Refactor collaboration APIs to include versionId in relevant functions and clean up commented code
This commit is contained in:
@@ -4,14 +4,16 @@ 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(
|
||||
@@ -27,7 +29,7 @@ export const addCommentsApi = async (
|
||||
body: JSON.stringify({ projectId, comment, threadId, commentId }),
|
||||
}
|
||||
);
|
||||
console.log('response: ', response);
|
||||
console.log("response: ", response);
|
||||
if (!response.ok) {
|
||||
console.error("Failed to add project");
|
||||
}
|
||||
|
||||
@@ -5,7 +5,8 @@ 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`, {
|
||||
@@ -16,13 +17,20 @@ 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,
|
||||
}),
|
||||
});
|
||||
if (!response.ok) {
|
||||
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) {
|
||||
|
||||
@@ -4,12 +4,14 @@ 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 {
|
||||
|
||||
@@ -4,12 +4,14 @@ 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 {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
let url_Backend_dwinzo = `http://${process.env.REACT_APP_SERVER_REST_API_BASE_URL}`;
|
||||
|
||||
export const getAllThreads = async (projectId: string, versionId: string) => {
|
||||
console.log("projectId: ", projectId, versionId);
|
||||
|
||||
try {
|
||||
const response = await fetch(
|
||||
`${url_Backend_dwinzo}/api/v1/Threads/${projectId}/${versionId}`,
|
||||
|
||||
Reference in New Issue
Block a user