Feature flags seeds, queries and hooks (#2769)

* seed is working

* allow graphql to retrieve feature flag data

* create useIsFeatureEnabled hook

* hook is working

* Update icons.ts
This commit is contained in:
bosiraphael
2023-11-29 16:40:44 +01:00
committed by GitHub
parent d855a42eca
commit 04c7c1a334
12 changed files with 174 additions and 17 deletions

View File

@ -0,0 +1,17 @@
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;
};