Skip to main content

useOrganizations

Hook that returns organizations.

Example

import React from 'react';
import { useCurrentUser, useOrganizations } from '@availity/hooks';

const Example = () => {
const { data: user } = useCurrentUser();
const { data, isFetching } = useOrganizations(
{ params: { permissionId: ['5'], userId: user?.id } },
{ enabled: !!user?.id }
);

return (
<div>
{isFetching
? 'Loading...'
: data?.data?.organizations?.[0]?.name || 'No organizations found'}
</div>
);
};

Props

config: AxiosRequestConfig

Config passed to the getOrganizations call from @availity/api-axios.

More information about this config can be found here

options?: QueryConfig

Options to be passed to the useQuery hook such as enabled, retry, and onSuccess.

More information on the options can be found here