more
This commit is contained in:
@@ -157,17 +157,23 @@ const DocEditPage = (props) => {
|
||||
}
|
||||
|
||||
async function getParsedRequests(docId, docType) {
|
||||
if (!docId || !docType) {
|
||||
console.log("docId, docType", docId, docType);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const response = await fetch(
|
||||
`${apiUrl}/getParsedRequests/${docId}/${docType}`,
|
||||
`${apiUrl}/v1/get-parsed-requestss/${docId}/${docType}`,
|
||||
{
|
||||
method: "GET",
|
||||
}
|
||||
);
|
||||
console.log("response in get parsed ", response);
|
||||
const res = await response.json();
|
||||
|
||||
return res;
|
||||
} catch (err) {
|
||||
console.log("Error occured:", err);
|
||||
console.log("getParsedRequests Error occured:", err);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,6 +187,11 @@ const DocEditPage = (props) => {
|
||||
"-------------------------data in useEffect for getParsedRequests",
|
||||
data
|
||||
);
|
||||
const resp = data[0].responses.map((item, index) => {
|
||||
// NEVER CHANGE THIS:
|
||||
return { showInputEle: false, resp: item.text, index: index };
|
||||
});
|
||||
setResponses(resp);
|
||||
})
|
||||
.catch((err) => console.log(err));
|
||||
}, [documentId]);
|
||||
@@ -190,23 +201,29 @@ const DocEditPage = (props) => {
|
||||
return;
|
||||
}
|
||||
const response = await fetch(
|
||||
`${apiUrl}/v1/get-parsed-requests/${docId}/${docType}`,
|
||||
`${apiUrl}/v1/get-completions/${docId}/${docType}`,
|
||||
{
|
||||
method: "GET",
|
||||
}
|
||||
);
|
||||
const req = await response.json();
|
||||
return req;
|
||||
const resp = await response.json();
|
||||
console.log("req getCompletions", resp);
|
||||
return resp;
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (!documentId) {
|
||||
return;
|
||||
}
|
||||
getDocument(documentId).then((data) => {
|
||||
setDocument(data);
|
||||
setDocType(data.docType);
|
||||
});
|
||||
getDocument(documentId)
|
||||
.then((data) => {
|
||||
setDocument(data);
|
||||
const tempType = data.docType;
|
||||
return tempType;
|
||||
})
|
||||
.then((type) => {
|
||||
setDocType(type);
|
||||
});
|
||||
}, [documentId]);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -223,31 +240,11 @@ const DocEditPage = (props) => {
|
||||
|
||||
getCompletions(documentId, docType)
|
||||
.then((data) => {
|
||||
console.log("data in getCompletions", data);
|
||||
//console.log("data in getCompletions", data);
|
||||
})
|
||||
.catch((err) => console.log(err));
|
||||
}, [documentId, docType]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!documentId || !docType) {
|
||||
return;
|
||||
}
|
||||
getParsedRequests(documentId, docType)
|
||||
.then((data) => {
|
||||
const resp = data[0].responses.map((item, index) => {
|
||||
// NEVER CHANGE THIS:
|
||||
return { showInputEle: false, resp: item.text, index: index };
|
||||
});
|
||||
return resp;
|
||||
})
|
||||
.then((resp) => {
|
||||
setParsedRogs(resp);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log("Error getting parsed requestas:", err);
|
||||
});
|
||||
}, [documentId, docType]);
|
||||
|
||||
async function postEditedResponses(docId, docType) {
|
||||
let obj = {};
|
||||
obj["type"] = docType;
|
||||
@@ -362,6 +359,27 @@ const DocEditPage = (props) => {
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (!documentId || !docType) {
|
||||
return;
|
||||
}
|
||||
getParsedRequests(documentId, docType)
|
||||
.then((data) => {
|
||||
const resp = data[0].responses.map((item, index) => {
|
||||
// NEVER CHANGE THIS:
|
||||
return { showInputEle: false, resp: item.text, index: index };
|
||||
});
|
||||
return resp;
|
||||
})
|
||||
.then((resp) => {
|
||||
console.log("knksdjfksdfn resp", resp);
|
||||
setParsedRogs(resp);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log("Error getting parsed requestas:", err);
|
||||
});
|
||||
}, [documentId, docType]);
|
||||
|
||||
const handleConfirmReport = () => {
|
||||
setShowSaveModal(true);
|
||||
setIsReport(true);
|
||||
@@ -451,7 +469,7 @@ const DocEditPage = (props) => {
|
||||
const handleBack = () => {
|
||||
navigate(`/documents`);
|
||||
};
|
||||
console.log("parsedrogs", parsedRogs);
|
||||
|
||||
const editingContent = () => {
|
||||
return (
|
||||
<>
|
||||
|
||||
Reference in New Issue
Block a user