-
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
Trek - Emilce - Octos #22
base: master
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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/
TREK
Congratulations! You're submitting your assignment!
Comprehension Questions