This commit is contained in:
Kenneth Jannette
2024-03-05 22:00:18 -06:00
parent de3d4c8429
commit 89aae714e7
2 changed files with 53 additions and 27 deletions

View File

@@ -174,8 +174,32 @@ const RequestEditPage = () => {
}
};
async function postEditedResponses() {
const mergedRequests = [...requests, ...prodReq];
let obj = {};
obj["type"] = "interrogatories-out";
obj["id"] = docId;
obj["requests"] = mergedRequests;
const data = JSON.stringify(obj);
try {
const response = await fetch(`${apiUrl}/v1/store-edited-completions`, {
method: "POST",
headers: { "Content-Type": "application/json" },
json: true,
body: data,
});
const res = response;
return res;
} catch (error) {
console.error("Error sending responses to the server:", error);
}
}
async function handleCreateDocx() {
// TODO: compare to see if any changes made before gen, save those
const res = await postEditedResponses();
const docId = documentId;
const leadAttorneys = fetchedCase?.leadAttorneys
? fetchedCase?.leadAttorneys
@@ -194,7 +218,9 @@ const RequestEditPage = () => {
: null;
try {
const response = await fetch(`${apiUrl}/genDocx/${docId}/${reqType}`, {
const response = await fetch(
`${apiUrl}/generate-request-docx/${docId}/${reqType}`,
{
method: "POST",
headers: {
Accept: "application/json",
@@ -219,7 +245,8 @@ const RequestEditPage = () => {
tel: telephone,
venue: venued,
}),
});
}
);
return response;
} catch (error) {
console.error("Error sending requests to the server:", error);

View File

@@ -103,7 +103,6 @@ const UploadModal = (props) => {
try {
if (radioValue === "complaint") {
if (clientPositiion === "Plaintiff") {
console.log("sending POST to: ", `${apiUrl}/v1/gen-disc-request-pl`);
const response = await fetch(`${apiUrl}/v1/gen-disc-request-pl`, {
method: "POST",
body: file,