more
This commit is contained in:
@@ -176,29 +176,6 @@ const RequestEditPage = () => {
|
|||||||
|
|
||||||
async function postEditedResponses() {
|
async function postEditedResponses() {
|
||||||
const mergedRequests = [...requests, ...prodReq];
|
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,
|
|
||||||
});
|
|
||||||
|
|
||||||
return response;
|
|
||||||
} 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 docId = documentId;
|
||||||
const leadAttorneys = fetchedCase?.leadAttorneys
|
const leadAttorneys = fetchedCase?.leadAttorneys
|
||||||
@@ -216,17 +193,7 @@ const RequestEditPage = () => {
|
|||||||
const clientPosition = fetchedCase?.clientPosition
|
const clientPosition = fetchedCase?.clientPosition
|
||||||
? fetchedCase?.clientPosition
|
? fetchedCase?.clientPosition
|
||||||
: null;
|
: null;
|
||||||
|
const caseInfo = {
|
||||||
try {
|
|
||||||
const response = await fetch(
|
|
||||||
`${apiUrl}/v1/generate-request-docx/${docId}/${reqType}`,
|
|
||||||
{
|
|
||||||
method: "POST",
|
|
||||||
headers: {
|
|
||||||
Accept: "application/json",
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
},
|
|
||||||
body: JSON.stringify({
|
|
||||||
caseCaption1: captionOne,
|
caseCaption1: captionOne,
|
||||||
caseCaption2: captionTwo,
|
caseCaption2: captionTwo,
|
||||||
caseNumber: caseNum,
|
caseNumber: caseNum,
|
||||||
@@ -244,9 +211,44 @@ const RequestEditPage = () => {
|
|||||||
state: state,
|
state: state,
|
||||||
tel: telephone,
|
tel: telephone,
|
||||||
venue: venued,
|
venue: venued,
|
||||||
}),
|
};
|
||||||
|
|
||||||
|
let obj = {};
|
||||||
|
obj["type"] = "interrogatories-out";
|
||||||
|
obj["id"] = docId;
|
||||||
|
obj["requests"] = mergedRequests;
|
||||||
|
obj["caseInfo"] = caseInfo;
|
||||||
|
|
||||||
|
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,
|
||||||
|
});
|
||||||
|
return response;
|
||||||
|
} 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();
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await fetch(`${apiUrl}/v1/generate-request-docx/`, {
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
Accept: "application/json",
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
body: JSON.stringify({
|
||||||
|
docId: docId,
|
||||||
|
}),
|
||||||
|
});
|
||||||
return response;
|
return response;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error sending requests to the server:", error);
|
console.error("Error sending requests to the server:", error);
|
||||||
|
|||||||
Reference in New Issue
Block a user