first
This commit is contained in:
commit
8538ab969a
434 changed files with 44051 additions and 0 deletions
|
|
@ -0,0 +1,23 @@
|
|||
import { useContext } from "react";
|
||||
import { ActiveOrganizationContext } from "../lib/active-organization-context";
|
||||
|
||||
export const useActiveOrganization = () => {
|
||||
const activeOrganizationContext = useContext(ActiveOrganizationContext);
|
||||
|
||||
type ActiveOrganizationContextType = NonNullable<
|
||||
typeof activeOrganizationContext
|
||||
>;
|
||||
|
||||
if (activeOrganizationContext === undefined) {
|
||||
return {
|
||||
activeOrganization: null,
|
||||
setActiveOrganization: () => Promise.resolve(),
|
||||
refetchActiveOrganization: () => Promise.resolve(),
|
||||
activeOrganizationUserRole: null,
|
||||
isOrganizationAdmin: false,
|
||||
loaded: true,
|
||||
} satisfies ActiveOrganizationContextType;
|
||||
}
|
||||
|
||||
return activeOrganizationContext;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue