The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/apps/meteor/ee/client/hooks/useHasLicenseModule.ts

16 lines
525 B

import { useMethod, useUserId } from '@rocket.chat/ui-contexts';
import { useQuery } from '@tanstack/react-query';
import type { BundleFeature } from '../../app/license/server/bundles';
export const useHasLicenseModule = (licenseName: BundleFeature): 'loading' | boolean => {
const method = useMethod('license:getModules');
const uid = useUserId();
const features = useQuery(['ee.features'], method, {
enabled: !!uid,
refetchOnWindowFocus: false,
});
return features.data?.includes(licenseName) ?? 'loading';
};