Skip to content

Commit ef4c2da

Browse files
committed
fixed form validation bug for description
1 parent 9b569c1 commit ef4c2da

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/pages/NewStory.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,13 @@ const NewStory = () => {
119119
setCurrentProductSelected(selectedProduct?.id ?? 'None')
120120
}
121121

122-
const onSubmit = async (data) => {
122+
const descError = () => {
123123
if (!description?.length) {
124124
setDescriptionError(true)
125-
return
126125
}
126+
}
127+
128+
const onSubmit = async (data) => {
127129
data.Description = filterDescriptionText(description)
128130
const formData = new FormData()
129131
formData.append('data', JSON.stringify(data))
@@ -270,6 +272,7 @@ const NewStory = () => {
270272
type='submit'
271273
data-cy='btn-submit'
272274
className='btn btn-default'
275+
onClick={descError}
273276
>
274277
Submit
275278
</Button>

0 commit comments

Comments
 (0)