import { useBackendStrict, useCancelablePromise } from "@gooddata/sdk-ui";
/**
 * @beta
 */
export function useFetchOrganization({ backend, organizationId }) {
    const effectiveBackend = useBackendStrict(backend, "useOrganization");
    return useCancelablePromise({
        promise: () => {
            return organizationId
                ? Promise.resolve(effectiveBackend.organization(organizationId))
                : effectiveBackend.organizations().getCurrentOrganization();
        },
    }, [effectiveBackend, organizationId]);
}
//# sourceMappingURL=useFetchOrganization.js.map