-
Notifications
You must be signed in to change notification settings - Fork 13
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
docs: guides & minor changes #1397
base: master
Are you sure you want to change the base?
Conversation
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 @Topener thanks! I added some comments on the blog posts, but overall this is a great addition and the suggestions are minor 👍
docs/guides/using-dataquery.md
Outdated
|
||
In the code above, we first check if there is an error by checking the `error` property. If there is an error, we display the error message. Next, we check if the query is still loading by checking the `loading` property. If the query is still loading, we display a loading spinner. Finally, if the query is successful, we display the data returned by the query. | ||
|
||
Keep in mind that the structure of the data returned by the query may vary depending on the query you execute. In this example, we are fetching Organisation Units, so the data returned by the query contains an `organisationUnits` property that contains an array of Organisation Units. We're also assuming the data structure is always the same. This is not really defensive programming, so you should always check if the data is in the expected format. |
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.
This is a good paragraph! Maybe link to somewhere that defines defensive programming so that someone who doesn't know what it is can learn more?
Also - we should mention here why we use data.orgUnits
(it matches the name we defined in our query object above, which could be anything)
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.
Updated it, but don't have a good resource where people can learn about it, any suggestions?
docs/guides/using-dataquery.md
Outdated
|
||
## Conclusion | ||
|
||
In this guide, we walked you through how to use the `useDataQuery` hook in your application to fetch data from the DHIS2 API. We covered how to define a query, execute the query, display the data, apply pagination, and apply filters to the query. By following these steps, you can fetch data from the DHIS2 API in your application with ease. You can now use this knowledge to fetch data from the DHIS2 API in your application and display it to your users, for every API endpoint available in the DHIS2 API. |
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.
The logical next step here is to use dynamic queries and refetch
with a button or search input. I think it's OK to not go into that here so this guide stays short, but we should mention it and say that we'll be following up with a second guide in the series which picks up where this one leaves off?
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.
Yes! Let's add that as a second guide, but also lets refrain from mentioning it for now so we can merge this PR and I can work on that one after!
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 need to mention the guide, but I would highly recommend mentioning that we support dynamic queries but that they are out of scope for this guide, with a link to the reference docs.
Quality Gate passedIssues Measures |
Added a few guides & some minor changes to make the docs slightly better