Skip to content

ports - sav#47

Open
qqdipps wants to merge 11 commits intoAda-C11:masterfrom
qqdipps:master
Open

ports - sav#47
qqdipps wants to merge 11 commits intoAda-C11:masterfrom
qqdipps:master

Conversation

@qqdipps
Copy link

@qqdipps qqdipps commented Jun 10, 2019

TREK

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
What does it mean for code to be asynchronous? Asynchronous code does not have to wait for a process to finish before executing additional code. It means that code can run while a block is waiting for a response from an external source such as an API.
Describe a piece of your code that executes asynchronously. How did this affect the way you structured it? The get request for trips index is sent using axios to the travel API which returns a promise. After the response is received the .then blocks are executed. If a .then block fails then the .catch will execute to handle the API errors. During which any block outside of the promise can be executed, thus this is an example of code that runs asynchronously.
What kind of errors might the API give you? How did you choose to handle them? The Travel API will respond with a 400 Bad Request if missing required information for reservation post request such as a missing name and/or email: {"errors":{"name":["can't be blank"],"email":["can't be blank"]}}. I choose to handle errors by iterating over the error object and modifying the DOM to include the error messages. In addition, I added front-end validations on the HTML, so that form can not be submitted with missing data there for reducing unnecessary calls to the Travel API.
Suppose you needed to routinely find a specific Trip in the list by its 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 advantageous to sort the data in the way that it is most commonly consumed because it is a better experience for the user.

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.

1 participant