From b388f7b5ca7b608b7fa5f5b5956ecc5e93a3482c Mon Sep 17 00:00:00 2001 From: Abhishek P Anil Date: Fri, 13 Jan 2023 11:45:45 +0530 Subject: [PATCH] fix: validation issue in event publish when image is present is fixed --- src/pages/Dashboard/AddEvent/AddEvent.jsx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/pages/Dashboard/AddEvent/AddEvent.jsx b/src/pages/Dashboard/AddEvent/AddEvent.jsx index 9025096a..d50ccfa1 100644 --- a/src/pages/Dashboard/AddEvent/AddEvent.jsx +++ b/src/pages/Dashboard/AddEvent/AddEvent.jsx @@ -208,7 +208,9 @@ function AddEvent() { navigate(`${PathName.Dashboard}/${calendarId}${PathName.Events}`).catch((error) => console.log(error)), ); }) - .catch((error) => console.log(error)); + .catch((error) => { + console.log(error); + }); }; useEffect(() => { @@ -636,15 +638,20 @@ function AddEvent() { ({ validator() { - if (!getFieldValue('dragger') || getFieldValue('dragger')?.length == 0) { - console.log(getFieldValue('dragger')); + if ( + (getFieldValue('dragger') != undefined && getFieldValue('dragger')?.length > 0) || + (eventData?.image?.original && !getFieldValue('dragger')) || + (eventData?.image?.original && getFieldValue('dragger')?.length > 0) + ) { + return Promise.resolve(); + } else return Promise.reject( new Error(t('dashboard.events.addEditEvent.validations.otherInformation.emptyImage')), ); - } else return Promise.resolve(); }, }), ]}>