Skip to content
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

Sockets - Riyo #24

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Sockets - Riyo #24

wants to merge 6 commits into from

Conversation

RPerry
Copy link

@RPerry RPerry commented Jun 3, 2019

TREK

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
What does it mean for code to be asynchronous? The user can still interact with a web page while waiting for an API response.
Describe a piece of your code that executes asynchronously. How did this affect the way you structured it? When a trip is clicked, a get request is sent but the page does not refresh and the user can continue to use the page as the trip details load.
What kind of errors might the API give you? How did you choose to handle them? The API might return a 404 error. I returned the status to the user.
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. You would be able to pass the ID into the get request regardless of the list order so it wouldn't be advantageous.

@CheezItMan
Copy link

TREK

What We're Looking For

Feature Feedback
Core Requirements
Git hygiene Good number of commits. It's better to provide descriptive commit messages rather than use wave numbers.
Comprehension questions Check, Asynchronous code is code which could run in any order. You cannot predict when an API callback will occur, or when an event handler will run.
Functionality
Click a button to load and view a list of trips Check
Clicking the "load" button twice does not cause each trip to display twice Check
Click a trip to load and view trip details Check
Clicking a different trip loads different details Check
Open network tab, then fill out a form to reserve a spot Check
Submitting the form only sends one POST request DOH! See my notes, you didn't finish wave 3.
Errors are reported to the user NOPE, you have most of the code in place, but a bug in your error messaging. See my notes.
Site is clearly laid out and easy to navigate Minimal styling
Under the Hood
Callback functions are not nested more than 2 levels deep Check
Callback functions are given descriptive names Check
Code is generally well-organized and easy to read Check
All API calls have both success and error callbacks defined Check
Optional but recommended: closures are used to keep track of which trip is selected Nice use of a closure!
HTML is semantic Check
CSS is DRY, uses CSS Grid, Flexbox, and/or Bootstrap Minimal Styling
Overall You hit most of the learning goals here. You didn't get the post request done, and you have some errors in ironically reporting errors. Take a look at my inline comments and let me know if you have questions.

});
})
.catch((error) => {
if (error.response.data && error.response.data.errors) {

Choose a reason for hiding this comment

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

It would also be appropriate to have error.response in your if statement to verify if there is a response object in error. Network errors won't have this.

<input type="submit" name="add-reservation" value="Reserve"/>
</form>`)

const reserve = createReservation(tripID);

Choose a reason for hiding this comment

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

Nice use of a closure.

</form>`)

const reserve = createReservation(tripID);
$('#trip-reservation-form').submit(reserve);

Choose a reason for hiding this comment

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

Shouldn't this be $('#reservation-form').submit instead?


const reservationData = readFormData();
reportStatus('Sending reservation data...');
axios.post(tripAPI + tripID + "/reservations", reservationData)

Choose a reason for hiding this comment

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

You need a slash between tripAPI and tripID

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