Skip to content

Commit e774739

Browse files
committed
fix: add allowedExtensions prop into upload
Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
1 parent 61be5aa commit e774739

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/components/mui/formik-inputs/mui-formik-upload.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,16 @@ const MuiFormikUpload = ({
2727
id,
2828
name,
2929
onDelete,
30-
maxFiles = MAX_INVENTORY_IMAGES_UPLOAD_QTY
30+
maxFiles = MAX_INVENTORY_IMAGES_UPLOAD_QTY,
31+
allowedExtensions
3132
}) => {
3233
const [field, meta, helpers] = useField(name);
3334

3435
const mediaType = {
3536
max_size: MAX_INVENTORY_IMAGE_UPLOAD_SIZE,
3637
max_uploads_qty: maxFiles,
3738
type: {
38-
allowed_extensions: ALLOWED_INVENTORY_IMAGE_FORMATS
39+
allowed_extensions: allowedExtensions || ALLOWED_INVENTORY_IMAGE_FORMATS
3940
}
4041
};
4142

@@ -108,7 +109,8 @@ MuiFormikUpload.propTypes = {
108109
id: PropTypes.string,
109110
name: PropTypes.string.isRequired,
110111
onDelete: PropTypes.func,
111-
maxFiles: PropTypes.number
112+
maxFiles: PropTypes.number,
113+
allowedExtensions: PropTypes.arrayOf(PropTypes.string)
112114
};
113115

114116
export default MuiFormikUpload;

0 commit comments

Comments
 (0)