moved alot of stuff from client side
This commit is contained in:
@@ -966,16 +966,33 @@ export const RenderFileUpload = (field) => {
|
||||
|
||||
let blobList = filelistObj;
|
||||
|
||||
function removeNullObjects(arr) {
|
||||
if (arr.length === 0) {
|
||||
return arr;
|
||||
}
|
||||
return arr.filter((obj) => obj !== null);
|
||||
}
|
||||
|
||||
function removeObjectsWithUndefinedKey(arr, key) {
|
||||
if (arr.length === 0) {
|
||||
return arr;
|
||||
}
|
||||
return arr.filter((obj) => obj[key] !== undefined);
|
||||
}
|
||||
|
||||
function removeEmptyObjects(arr) {
|
||||
return arr.filter((obj) => Object.keys(obj).length > 0);
|
||||
if (arr.length === 0) {
|
||||
return arr;
|
||||
}
|
||||
return arr.filter(
|
||||
(obj) =>
|
||||
obj && typeof obj === "object" && Object.keys(obj).length > 0
|
||||
);
|
||||
}
|
||||
|
||||
blobList = removeEmptyObjects(blobList);
|
||||
blobList = removeObjectsWithUndefinedKey(blobList, "name");
|
||||
blobList = removeNullObjects(blobList);
|
||||
|
||||
let buildAppealFilesArray = [];
|
||||
|
||||
@@ -1079,7 +1096,7 @@ export const RenderFileUpload = (field) => {
|
||||
{field.meta.touched && field.meta.error && (
|
||||
<span className="error">{field.meta.error}</span>
|
||||
)}
|
||||
{blobList && Array.isArray(files) && (
|
||||
{/* {files && Array.isArray(files) && (
|
||||
<ul>
|
||||
{files.map(
|
||||
(file, i) =>
|
||||
@@ -1100,7 +1117,7 @@ export const RenderFileUpload = (field) => {
|
||||
)
|
||||
)}
|
||||
</ul>
|
||||
)}
|
||||
)} */}
|
||||
{blobList.map((blob, i) => (
|
||||
<div
|
||||
key={blob.name + "_" + i}
|
||||
@@ -1169,8 +1186,19 @@ export function FileUploadField(props) {
|
||||
setFilesForAppeal={props.setFilesForAppeal}
|
||||
containerID={props.containerID}
|
||||
filenamePrefix={
|
||||
props.filenamePrefix.formObj.representationForm.values
|
||||
.repfile_name
|
||||
props.filenamePrefix.hasOwnProperty("representationForm") &&
|
||||
props.filenamePrefix.representationForm.hasOwnProperty(
|
||||
"values"
|
||||
) &&
|
||||
props.filenamePrefix.representationForm.values.hasOwnProperty(
|
||||
"repfile_name"
|
||||
)
|
||||
? props.filenamePrefix.representationForm.values
|
||||
.repfile_name
|
||||
: props.filenamePrefix.hasOwnProperty("formObj")
|
||||
? props.filenamePrefix.formObj["representationForm"]
|
||||
.values.repfile_name
|
||||
: ""
|
||||
}
|
||||
/>
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user