This commit is contained in:
Kenneth Jannette
2024-03-02 01:39:12 -06:00
parent 9e2faab87b
commit efdc0c357a

View File

@@ -74,6 +74,29 @@ const RequestEditPage = () => {
}
}, [appUserId, docId, caseId]);
/*
* GET parsed requests.
* GET completions if already generated
*/
useEffect(() => {
if (!documentId || !documentType) {
return;
}
getOutgoingRequests(documentId)
.then((data) => {
console.log("data in getOutgoingRequests"), 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]);
async function getCase(parentCaseId) {
try {
const docRef = doc(db, "cases", `${parentCaseId}`);
@@ -90,6 +113,18 @@ const RequestEditPage = () => {
}
}
async function getOutgoingRequests(docId) {
const docType = String(documentType);
const response = await fetch(
`${apiUrl}/v1/get-outgoing-requests/${docId}/${docType}`,
{
method: "GET",
}
);
const req = await response.json();
return req;
}
const onScrollClick = () => {
const bottom = window.document.scrollingElement.scrollHeight;
const place = window.scrollY;