Skip to content

Conversation

@madaleines
Copy link

TREK

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
What does it mean for code to be asynchronous? You don't have to wait for the request/response to be finished before interacting with the page
Describe a piece of your code that executes asynchronously. How did this affect the way you structured it? When I click on a single to trip load I can also have the option to reserve said trip with a form that loads at the same time/
What kind of errors might the API give you? How did you choose to handle them? If you didn't complete the form it would raise an error.
Suppose you needed to routinely find a specific Trip in 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. Yes it would be because it will keep the data associated with it in order.

@tildeee
Copy link

tildeee commented Dec 11, 2018

TREK

What We're Looking For

Feature Feedback
Core Requirements
Git hygiene x
Comprehension questions x, I'd prefer to have a more specific answer for how you handle errors. You wrote "If you didn't complete the form it would raise an error." What does it mean if an API raises an error? How did you handle that?
Functionality
Click a button to load and view a list of trips x
Click a trip to load and view trip details x
Fill out a form to reserve a spot x
Errors are reported to the user x
CSS is DRY and attractive, uses CSS Grid, flexbox, and/or Bootstrap x
Under the Hood
Trip data is retrieved using from the API x
JavaScript is well-organized and easy to read x
HTML is semantic x
Overall

Great work on this Maddie!
Your code is full of helper functions and interesting one-line functions! It's all very dense. Nice!!!!

I've added a few comments about a few small things.

Otherwise, I'd consider your code to be very functional, very action-packed, and very fancy.

Good work!

.then((response) => {
tripInfo.append(getInfo(response.data))
.append(loadForm());
$('#reservation-form').submit(function(event) { createReservation(event, tripID); });
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice anonymous function!

event.preventDefault();
axios.post(getReservationURL(tripID), reservationFormData())
.then((response) => {
reportStatus(`Successfully added a reservation with ID ${response.data.trip_id}!`);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This text says that the reservation has an ID... but you put into the message the trip's ID! hahaha


$('#load-trips-button').on('click', function() {
$('#list').slideDown('slow');
loadTrips(null);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you need to pass in null?

.promise().done(function() {
getTrip(event.target.classList[1]);
$('.side-info').slideDown('slow');
});
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FFFAAANCY

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be even fancier if you found a way to move the getTrip() call into the loadTrips function when you create each trip listing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants