-
Notifications
You must be signed in to change notification settings - Fork 48
Sockets - Shirley #44
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
base: master
Are you sure you want to change the base?
Conversation
TREKWhat We're Looking For
|
| <form>`; | ||
|
|
||
| // sends GET request to endpoint | ||
| axios.get(tripURL) |
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.
Why do you do a get request to load the form. You shouldn't need 2 get requests to retrieve details about one trip.
| tripForm(this.id) | ||
| }); | ||
| $('#tripForm').on('submit', 'button', function () { | ||
| makeReservation(this.class) |
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.
You also need to add an event parameter and call event.preventDefault()
You also need to adjust the id, as your form is using trip-form
Lastly this.class should be this.className or event.target.className
| const tripURL = tripListURL + '/' + tripID; | ||
|
|
||
|
|
||
| const form = `<form id='trip-form' class=${tripID}> |
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.
If you are generating the form new each time someone clicks on a trip, you will need to create a new event handler for the new form. The generated form wasn't around when the event handler was added.
|
|
||
|
|
||
| const makeReservation = (tripID) => { | ||
| const tripURL = tripListURL + '/' + tripID; |
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.
tripID here is going to be undefined.
TREK
Congratulations! You're submitting your assignment!
Comprehension Questions
Tripin the list by it's ID field. Would it be advantageous to keep the list in order by the id field? Explain why or why not.