* seed is working * allow graphql to retrieve feature flag data * create useIsFeatureEnabled hook * hook is working * Update icons.ts
18 lines
438 B
TypeScript
18 lines
438 B
TypeScript
import { useRecoilValue } from 'recoil';
|
|
|
|
import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
|
|
|
|
export const useIsFeatureEnabled = (featureKey: string): boolean => {
|
|
const currentWorkspace = useRecoilValue(currentWorkspaceState);
|
|
|
|
const featureFlag = currentWorkspace?.featureFlags?.find(
|
|
(flag) => flag.key === featureKey,
|
|
);
|
|
|
|
if (!featureFlag) {
|
|
return false;
|
|
}
|
|
|
|
return featureFlag.value;
|
|
};
|