more
This commit is contained in:
@@ -240,29 +240,68 @@ const RequestEditPage = () => {
|
||||
}
|
||||
}
|
||||
|
||||
async function handleCreateDocx() {
|
||||
const res = await postEditedResponses();
|
||||
function sleep(ms) {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
}
|
||||
await sleep(2000);
|
||||
async function handleCreateDocx(docType) {
|
||||
// TODO: compare to see if any changes made before gen, save those
|
||||
const docId = documentId;
|
||||
const leadAttorneys = fetchedCase?.leadAttorneys
|
||||
? fetchedCase?.leadAttorneys
|
||||
: null;
|
||||
const reqType = docType;
|
||||
const captionOne = fetchedCase?.caption;
|
||||
const captionTwo = fetchedCase?.captionTwo;
|
||||
const caseNum = fetchedCase?.caseNumber;
|
||||
const plaintiffs = fetchedCase?.plaintiffParties;
|
||||
const defendants = fetchedCase?.defendantParties;
|
||||
const venued = fetchedCase?.venue;
|
||||
const juris = fetchedCase?.jurisdiction;
|
||||
const judge = fetchedCase?.judge;
|
||||
const clientPosition = fetchedCase?.clientPosition
|
||||
? fetchedCase?.clientPosition
|
||||
: null;
|
||||
const currentRequestType = docType;
|
||||
try {
|
||||
const response = await fetch(
|
||||
`${apiUrl}/v1/generate-request-docx/${docId}`,
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
Accept: "application/json",
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
docId: docId,
|
||||
}),
|
||||
}
|
||||
);
|
||||
return response;
|
||||
} catch (error) {
|
||||
console.error("Error sending requests to the server:", error);
|
||||
const response = await fetch(`${apiUrl}/v1/store-docx-data/${docId}`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
caseCaption1: captionOne,
|
||||
caseCaption2: captionTwo,
|
||||
caseNumber: caseNum,
|
||||
clientPosition: clientPosition,
|
||||
currentRequestType: currentRequestType,
|
||||
defendant: defendants,
|
||||
firm: lawFirm,
|
||||
firmCity: city,
|
||||
firmState: usState.code,
|
||||
firmStreetAddress: streetAdd,
|
||||
firmZip: zipCode,
|
||||
judge: judge,
|
||||
jurisdiction: juris,
|
||||
leadAttorneys: leadAttorneys,
|
||||
plaintiff: plaintiffs,
|
||||
state: state,
|
||||
tel: telephone,
|
||||
venue: venued,
|
||||
}),
|
||||
});
|
||||
if (response.status === 200) {
|
||||
const resp = await fetch(
|
||||
`${apiUrl}/v1/generate-request-docx/${docId}`,
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
Accept: "application/json",
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
return resp;
|
||||
}
|
||||
} catch (err) {
|
||||
console.log("err in postDocxData", err);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -537,3 +576,32 @@ const RequestEditPage = () => {
|
||||
};
|
||||
|
||||
export default RequestEditPage;
|
||||
|
||||
/*
|
||||
|
||||
async function handleCreateDocx() {
|
||||
const res = await postEditedResponses();
|
||||
function sleep(ms) {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
}
|
||||
await sleep(2000);
|
||||
try {
|
||||
const response = await fetch(
|
||||
`${apiUrl}/v1/generate-request-docx/${docId}`,
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
Accept: "application/json",
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
docId: docId,
|
||||
}),
|
||||
}
|
||||
);
|
||||
return response;
|
||||
} catch (error) {
|
||||
console.error("Error sending requests to the server:", error);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user