-
Notifications
You must be signed in to change notification settings - Fork 42
Caroline Nardi - Trek - Octos #40
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
…peating on each load call.
TREKWhat We're Looking For
|
|
|
||
| html += `<h2>Trip Details</h2> | ||
| <div> | ||
| <h3>Name: ${this.innerHTML}<h3> |
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.
It might make sense to break the code to render trip details out into a separate function - as is, this function is doing two things (making the request, and rendering data). See also http://callbackhell.com/
| $(document).ready(() => { | ||
| $("#load-trips").click(loadTrips); | ||
| $("#trip-list").on("click", "li", loadTripDetails); | ||
| $("#trip-list").on("click", "li", loadReserveTrip); |
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.
Rather than running loadReserveTrip immediately when a trip is clicked, it might work better to only load it when the GET request for the individual trip comes back. That is, call that function from within the then callback of loadTripDetails.
| const loadReserveTrip = function loadReserveTrip() { | ||
|
|
||
| const reserveTrip = $("#reserve-trip"); | ||
| reserveTrip.empty(); |
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.
I like the idea of breaking this code out into a separate function. Good organization!
TREK
Congratulations! You're submitting your assignment!
Comprehension Questions