Add props.onImageChange check in the slider change description handler

This commit is contained in:
kvakazyambra 2023-11-10 01:21:09 +03:00
parent fedcfea23f
commit 46db039ced

View File

@ -46,8 +46,10 @@ export const ImageSwiper = (props: Props) => {
} = useSnackbar() } = useSnackbar()
const handleSlideDescriptionChange = (index: number, field: string, value) => { const handleSlideDescriptionChange = (index: number, field: string, value) => {
if (props.onImageChange) {
props.onImageChange(index, { ...props.images[index], [field]: value }) props.onImageChange(index, { ...props.images[index], [field]: value })
} }
}
const swipeToUploaded = () => { const swipeToUploaded = () => {
setTimeout(() => { setTimeout(() => {
mainSwipeRef.current.swiper.slideTo(props.images.length - 1) mainSwipeRef.current.swiper.slideTo(props.images.length - 1)