From efdc0c357af5a9051d872abb6a272a2c4a30072f Mon Sep 17 00:00:00 2001 From: Kenneth Jannette Date: Sat, 2 Mar 2024 01:39:12 -0600 Subject: [PATCH] more --- src/Components/Document/ReqEditPage.js | 35 ++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/Components/Document/ReqEditPage.js b/src/Components/Document/ReqEditPage.js index 9bf9a97..ab67b80 100644 --- a/src/Components/Document/ReqEditPage.js +++ b/src/Components/Document/ReqEditPage.js @@ -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;