Skip to content

Conversation

@jessy96
Copy link
Owner

@jessy96 jessy96 commented Dec 28, 2021

No description provided.

Copy link
Collaborator

@Vladyslav-Velytskyi Vladyslav-Velytskyi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably validation message has it's own style
image
but you have an another, please, fix it
image


const MovieSchema = Yup.object().shape({
title: Yup.string().required(),
url: Yup.string().required(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will be logically if it has url validation, because random string couldn't be a url. Yup has api for it

Suggested change
url: Yup.string().required(),
url: Yup.string().url().required(),

title: Yup.string().required(),
url: Yup.string().required(),
releaseDate: Yup.string().required(),
rating: Yup.number()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For number you can use min() and max()

Suggested change
rating: Yup.number()
rating: Yup.number(),min(0).max(10)

return val >= 0
}),
overview: Yup.string().required()
})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also you can check data types in the backend side, they use Joi library, it's almost the same to Yup

value={formik.values.title}
onBlur={formik.handleBlur('title')}
/>
{formik.touched.title && formik.errors.title}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Create a simple component which will render error according to mockup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants