Skip to content

Movie creation form + validation#15

Open
AndreiCostinOlaru wants to merge 2 commits intomasterfrom
Movie-Form
Open

Movie creation form + validation#15
AndreiCostinOlaru wants to merge 2 commits intomasterfrom
Movie-Form

Conversation

@AndreiCostinOlaru
Copy link
Copy Markdown
Collaborator

No description provided.

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

const createMovie = async (values) => {
console.log(values)
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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