telemed-api-layer-sdk
v0.4.8
Published
test
Downloads
1
Maintainers
Readme
telemed-api
api
Installation
npm install telemed-api
Usage
Wrap your application around APIProvider
import { APIProvider } from 'telemed-api-layer';
// ...
return (
<APIProvider>
<YourApp />
</APIProvider>
);
Update the environment
import { useClient } from 'telemed-api-layer';
// ...
const { setEnvironment } = useClient();
React.useEffect(() => {
setEnvironment('dev'); // Possible environments are dev/qa/prod/sit/test
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
Read this value from the environment variable you can set in the UI layer
Custom hooks usage
import { ConsultationError, useConsultationInfo } from 'telemed-api';
// ...
const consultationId = '63db9806d672cb123fdb01ad';
const { data, isLoading, isError, error, refetch } =
useConsultationInfo(consultationId);
In this way you can get details about any consultation using consultationId. You can use respective attributes to show appropriate UI in UI layer
e.g.
- isLoading indicates the api call is in progress
- isError indicates the api call failed and there is an error
- error is the error received from server
- data is the object which will be undefined when api call is in progress, and once api call is executed successfully it will be containing all the attribute related to consultation
Contributing
See the contributing guide to learn how to contribute to the repository and the development workflow.
License
MIT
Made with create-react-native-library