-
Notifications
You must be signed in to change notification settings - Fork 48
Sockets - Pauline #32
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
|
| displayTripDetails(trip); | ||
|
|
||
| reportStatus(`Successfully loaded details for: ${trip.name}`); | ||
| $('#reservation-form').submit(() => reserveTrip(trip)) |
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.
So every time I click on a trip you add another event handler which will run when the form gets submitted. You should use $('#reservation-form').off() to clear out any existing event handlers first.
Oh and nice closure!
| }) | ||
| .catch((error) => { | ||
| console.log(error.response); | ||
| if (error.response.data && error.response.data.errors) { |
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.
This should include: if (error.response && error.response.data && error.response.data.errors) {
just so that if there's a network error the error can be reported. (no response object for a network error).
TREK
Congratulations! You're submitting your assignment!
Comprehension Questions
load trips). I used reportStatus & reportError functions to catch & display the error to the user should one occur.Tripin the list by its ID field. Would it be advantageous to keep the list in order by the id field? Explain why or why not.