-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: master
Are you sure you want to change the base?
Conversation
const response = await axios.post('/api/movies', {id: 7, name: "Dune" }) | ||
|
||
const createMovie = async (values) => { | ||
console.log(values) |
There was a problem hiding this comment.
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"){ |
There was a problem hiding this comment.
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?
There was a problem hiding this 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
No description provided.