signoz/frontend/src/hooks/useGetFeatureFlag.tsx
Vikrant Gupta 26fe5e49e7
chore: revamp the frontend architecture (#6598)
* feat: setup the app context to fetch users,licenses and feature flags

* feat: added global event listeners for after_login event

* feat: remove redux from app state and private route

* feat: syncronize the approutes file

* feat: cleanup the private routes

* feat: handle login and logout

* feat: cleanup the app layout file

* feat: cleanup and syncronize side nav item

* fix: minor small re-render issue

* feat: parallel processing for sync calls for faster bootup of application

* feat: some refactoring for private routes

* fix: entire application too much re-rendering

* fix: remove redux

* feat: some more corrections

* feat: fix all the files except signup

* feat: add app provider to the test-utils

* feat: should fix a lot of tests

* chore: fix more tests

* chore: fix more tests

* feat: fix some tests and corrected the redux mock

* feat: delete snapshot

* fix: test cases

* fix: pipeline actions test cases

* fix: billing test cases

* feat: update the signup API to accept isAnonymous and hasOptedUpdates

* chore: cleanup the console logs

* fix: indefinite loading on manage licenses screen

* fix: better handling and route to something_went_wrong in case of qs down

* fix: signup for subsequent users

* chore: update test-utils

* fix: jerky behaviour on entering the home page

* feat: handle the retention for login context flow

* fix: do not let users workaround workspace blocked screen
2024-12-20 14:00:02 +05:30

19 lines
637 B
TypeScript

import getFeaturesFlags from 'api/features/getFeatureFlags';
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
import { useQuery, UseQueryResult } from 'react-query';
import { FeatureFlagProps } from 'types/api/features/getFeaturesFlags';
const useGetFeatureFlag = (
onSuccessHandler: (routes: FeatureFlagProps[]) => void,
isLoggedIn: boolean,
): UseQueryResult<FeatureFlagProps[], unknown> =>
useQuery<FeatureFlagProps[]>({
queryFn: getFeaturesFlags,
queryKey: [REACT_QUERY_KEY.GET_FEATURES_FLAGS],
onSuccess: onSuccessHandler,
retryOnMount: false,
enabled: !!isLoggedIn,
});
export default useGetFeatureFlag;