-
Notifications
You must be signed in to change notification settings - Fork 44
Mariana-Pipes-BackTreck #21
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
BackTREKWhat We're Looking For
|
| const inputElement = $(`#reservation-form input[name="${ field }"]`); | ||
| const value = inputElement.val(); | ||
| reservationData[field] = value; | ||
| inputElement.val(''); |
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.
Right here you're clearing all the field values, including the hidden field where you're hiding the trip id. Instead wait to clear the values until a save is successful. If someone fails validations, the trip Id is being cleared and thus no subsequent reservation will work.
| }; | ||
|
|
||
| // Add a new status message | ||
| const reportStatus = function reportStatus(status, message) { |
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 function should also clear the container of error messages. Now they never go away.
|
|
||
| const Reservation = Backbone.Model.extend({ | ||
| url: function() { | ||
| console.log('https://ada-backtrek-api.herokuapp.com/trips/'+this.trip_id+'/reservations'); |
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 more sense to use urlRoot like so:
urlRoot() {
return `https://ada-backtrek-api.herokuapp.com/trips/${this.get('trip_id')}/reservations`;
}
It's also preferred style to use interpolation.
| const Trip = Backbone.Model.extend({ | ||
| url: function() { | ||
| return `https://ada-backtrek-api.herokuapp.com/trips/` + (this.id || '') | ||
| } |
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 should be handling client-side validations here and in Reservation.
BackTREK
Congratulations! You're submitting your assignment!
Comprehension Questions