-
Notifications
You must be signed in to change notification settings - Fork 43
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
Selam Ainalem Amperes #28
base: master
Are you sure you want to change the base?
Conversation
…ature (hover - bold text) over trips. Added On-click jquery method that is intended to be used for populating <ul> of trip details.
…s. New methods include: singleTripURL - path to API that requires trip id, loadTripdetails(), method that makes call to API with given trip ID passed in from click event, and .on() method that waits for a click event on the #all-trips list and passes in the list item to the loadTripdetails function.
…ption to toggle between viewing/not viewing a form. Added a form with a button to create a reservation. Buttons are currently not linked to API.
…ing - will refactor if theres time) form is displayed to user if they decide to purchase the currently viewed trip.
…ill be displayed a confirmation that a trip was reserved or an error message.
…yed error messages if they violate API input requirements.
…, cleaned up lines for index.js
|
||
$(`#create-trip`).submit(createTrip); | ||
$(document).on("click","#submit-trip",function(){ | ||
$('#create-trip').toggle("slow") |
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.
Don't forget your semicolons!
|
||
$(document).on("click","#submit-button",function(event){ | ||
$(`#submit-button`).toggle(); | ||
$(`#book-trip-form`).append(`<button id="button-success" class="button success">Trip Booked!</button>`); |
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 always has a successful button, even if the reservation wasn't made correctly!
.catch((error) => { | ||
reportStatus('fail') | ||
if( error.message && error.response.data.errors){ | ||
let v = 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.
what does v
stand for?
console.log(v) | ||
reportError(error.message,error.response.data.errors) | ||
}else | ||
reportError(`encounted error: ${error.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.
your formatting, indentation, and semicolons!
|
||
let reserveAtrip = function(tripID){ | ||
let singleURL =`` | ||
return singleURL+= `https://ada-backtrek-api.herokuapp.com/trips/${tripID}/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.
you set the variable singleURL
to an empty string, and then return it after concatenating a URL... isn't this the same as
let reserveAtrip = function(tripID){
return `https://ada-backtrek-api.herokuapp.com/trips/${tripID}/reservations`
}
Also, camel case on this is a little off, I might call this function reserveTrip
or reserveSingleTrip
or something similar
TREKWhat We're Looking For
Fffffaaaancy jQuery work!!!! Looks good! Your code looks fine, except for a few comments I left and... you forgot semicolons at the end of lines all over the place! Particularly the lines where you appended a lot of HTML. Good work though! Good work on the optional of creating a trip, too. |
TREK
Congratulations! You're submitting your assignment!
Comprehension Questions