Merge pull request #141 from kjannette/refactUpload

Refact upload
This commit is contained in:
S Jannette
2024-03-07 23:01:34 -06:00
committed by GitHub

View File

@@ -119,49 +119,20 @@ const UploadModal = (props) => {
}
async function uploadFile(file) {
console.log(
"uploadFile radioValue, clientPosition",
radioValue,
clientPosition
);
if (!clientPosition) {
return;
}
const now = new Date();
try {
if (radioValue.toLowerCase() === "complaint") {
if (clientPosition === "Plaintiff") {
console.log(
"111111111--------------------------sending POST to:",
`${apiUrl}/v1/gen-disc-request-pl`,
"----------------------------------------at time:",
`${now}`
);
const response = await fetch(`${apiUrl}/v1/gen-disc-request-pl`, {
method: "POST",
body: file,
});
const res = response;
return res;
} else if (clientPosition === "Defendant") {
console.log(
"222222222------------------------------sending POST to:",
`${apiUrl}/v1/gen-disc-request-df`,
"----------------------------------------at time:",
`${now}`
);
const response = await fetch(`${apiUrl}/v1/gen-disc-request-df`, {
method: "POST",
body: file,
});
const res = response;
return res;
}
console.log("/upload-convert-complaint");
const response = await fetch(`${apiUrl}/v1/gen-disc-request-out`, {
method: "POST",
body: file,
});
const res = response;
return res;
} else {
console.log(
"3333333333333 -------------------------sending POST to:",
`${apiUrl}/v1/parse-new-req-doc`
);
const response = await fetch(`${apiUrl}/v1/parse-new-req-doc`, {
method: "POST",
body: file,
@@ -220,7 +191,7 @@ const UploadModal = (props) => {
const response = await processFile();
saveToDb(response.uuidName);
handleSuccess(docType, response.uuidName);
handleSuccess(docType, response.uuidName, radioValue);
return;
} catch (err) {
console.log("err", err);