-
-
Notifications
You must be signed in to change notification settings - Fork 713
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
fixed Typescript Hard issue: Implement Fetch and Display Functions for Product List #649 #826
fixed Typescript Hard issue: Implement Fetch and Display Functions for Product List #649 #826
Conversation
This PR has Quantification details
Why proper sizing of changes matters
Optimal pull request sizes drive a better predictable PR flow as they strike a
What can I do to optimize my changes
How to interpret the change counts in git diff output
Was this comment helpful? 👍 :ok_hand: :thumbsdown: (Email) |
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.
Looks good!
displayProducts(products); | ||
try { | ||
const response = await fetch('https://dummyjson.com/products'); | ||
const data = await response.json(); |
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.
Code looks really good! It is generally good idea to check if the response is actually ok with something like this:
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
Otherwise, i don't really see any major things that could be improved here, nicely done!
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.
yeah, next time i'll take care.
Thank you!
Merged
Thank you for your contribution! Your pull request has been merged. The files have been reset for the next contributor. What's next?If you're looking for more ways to contribute, I invite you to check out my other projects. Just click here to find more. These projects contain real issues that you can help resolve. You can also check out the Influences section in the README to find more projects similar to this one. Also please leave a star to this project if you feel it helped you, i would really appreciate it. I look forward to seeing your contributions! |
Description
fixes: #649
fetchData Function:
Used fetch API to get data from https://dummyjson.com/products.
Parsed JSON, updating global products.
displayProducts Function:
Cleared previous table rows.
Created HTML rows for each product.
applyFilters Function:
Filtered products based on criteria.
Additional Context
I'm new to open source. Please suggest for any additional implementations or ways to help me improve.
Thank you!