useOrganizations()
useOrganizations()
is a stateful hook providing access to information about organizations the user is a member of. Use this hook to list organizations, see the current organization and switch to another organization.
Each instance of this hook will fetch its own organization data, use with caution.
Usage
import { useOrganizations } from "@slashid/react";
function Component() {
const {
organizations,
currentOrganization,
switchOrganization,
isLoading
} = useOrganizations()
// ...
}
API
Property | Type | Description |
---|---|---|
currentOrganization | OrganizationDetails | null | The users current organization, resolves to null during initialisation |
organizations | OrganizationDetails[] | A list of all organizations the user is a member of |
switchOrganization | ({ oid: string }) => void | Switches to another organization. A new SlashID user token is minted which is scoped to the new organization, it has the same factors and expiry as the previous token. |
isLoading | boolean | The loading state of the organization data provided by this hook |