Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Movie creation form + validation #15

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

AndreiCostinOlaru
Copy link
Collaborator

No description provided.

const response = await axios.post('/api/movies', {id: 7, name: "Dune" })

const createMovie = async (values) => {
console.log(values)
Copy link
Owner

Choose a reason for hiding this comment

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

We should remove this console log

const nameParts = name.split('.');

let transformedName = nameParts[1] != undefined?`${nameParts[0]}[${nameParts[1]}].${nameParts[2]}`:`${nameParts[0]}`;
if(nameParts[0] == "crew"){
Copy link
Owner

Choose a reason for hiding this comment

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

Instead of edge casing a component that can be reusable to handle "crew", we could leave the FormField as a template and create a CrewFormField that would handle the transformed name for the crew. Also, why do we need such a long name for the input name?

Copy link
Owner

@OctaFloare OctaFloare left a comment

Choose a reason for hiding this comment

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

Nice work adding validation, extracting components, handling errors. Awesome job

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.

2 participants