useOrganization.tsx 352 B

12345678910111213
  1. import {useContext} from 'react';
  2. import {OrganizationContext} from 'sentry/views/organizationContext';
  3. function useOrganization() {
  4. const organization = useContext(OrganizationContext);
  5. if (!organization) {
  6. throw new Error('useOrganization called but organization is not set.');
  7. }
  8. return organization;
  9. }
  10. export default useOrganization;