useOrganization

πŸ‘¨β€πŸ’» Use this hook to get the current user organization.

🚧

Authentication required to use this hook

The useOrganization hook will call and return a response from the UserOrganization API.

Hooks Sample Code

...
import useOrganization from "mojito-hooks/useOrganization";

function App {
    const { organization, isLoading } = useOrganization();

    if(isLoading) return <Loader />;

    if(organization) return (
        <div>
            {organization.user.email}
        </div>
    );

    return <div>No organization available</div>
}

Parameters

πŸ“˜

This hook doesn't accept any parameters.

Result

PropertyDescriptionType
organizationObject represents the information of a user organization.MojitoUserOrganization
isLoadingDisplay request loading status, provided for convenience.Boolean
errorThe error object for the query, if an error was thrown.Error
refetchA function to manually refetch the query.(options: T) => Promise<U>
queryResultOriginal React-Query query result.QueryResult<T>