Open
Conversation
…ps list into table
TREKWhat We're Looking For
|
| <div class="aside"> | ||
| <section id="details"> | ||
| </section> | ||
| </div> |
There was a problem hiding this comment.
Why not use an <aside> here instead of <div class="aside">?
| const loadTrips = function loadTrips() { | ||
| let tripList = $('#trip-list'); | ||
|
|
||
| axios.get(allTripsUrl) |
There was a problem hiding this comment.
You don’t empty out the element holding your trip list before you load it, so if you click on “show trips” multiple times, the trips get added multiple times
| axios.get(singleTripUrl + $(this).data("id")) | ||
| .then((response) => { | ||
| $('#details').empty().append(`<h2>${response.data.name}</h2><h3>${response.data.continent}</h3><p>${response.data.about}</p><p>Category of trip: ${response.data.category}</p><p>Duration of trip (in weeks): ${response.data.weeks}</p><p>$${response.data.cost}</p>`); | ||
| reportStatus('Trips Loaded!'); |
There was a problem hiding this comment.
Line 57 should be broken up into multiple lines. 80 characters is usually considered the widest a line should be.
Also, 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/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TREK
Congratulations! You're submitting your assignment!
Comprehension Questions