Skip to content

Commit

Permalink
Merge pull request #84 from culturecreates/feature/issue-21
Browse files Browse the repository at this point in the history
fix: validation issue in event publish when image is present is fixed
  • Loading branch information
saumier authored Jan 13, 2023
2 parents 0d16442 + b388f7b commit 475adf9
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/pages/Dashboard/AddEvent/AddEvent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down Expand Up @@ -636,15 +638,20 @@ function AddEvent() {
<Form.Item
label={t('dashboard.events.addEditEvent.otherInformation.image.title')}
name="dragger-wrap"
initialValue={eventData?.image && eventData?.image?.original}
rules={[
({ getFieldValue }) => ({
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();
},
}),
]}>
Expand Down

0 comments on commit 475adf9

Please sign in to comment.