smart-on-fhir / ehi-app

EHI Export API Client Reference Implementation
https://ehi-app.smarthealthit.org/
Apache License 2.0
4 stars 1 forks source link

useAsync refactor #23

Closed Dtphelan1 closed 1 year ago

Dtphelan1 commented 1 year ago

Addresses #7, leveraging our useAsync hook to encapsulate async-data loading, error, return-value tracking, and subsequent update calls. This branch is based off of #21, and shouldn't merge before that.

To test, you can take advantage of the sleep() function I've created. By changing the useAsync callback from whatever it is now to an async fn that awaits a call to sleep() will allow you to log and see that loading is triggering successfully. Additionally, you can throw errors from within that fn to ensure it handles errors appropriately.