Skip to content

Commit c6a24d1

Browse files
committed
chore: revert unnecessary changes
1 parent ffe1ed4 commit c6a24d1

File tree

3 files changed

+20
-19
lines changed

3 files changed

+20
-19
lines changed

frontend/src/api/features/getFeatureFlags.ts

Lines changed: 0 additions & 10 deletions
This file was deleted.

frontend/src/hooks/useGetFeatureFlag.tsx

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,29 @@
1-
import getFeaturesFlags from 'api/features/getFeatureFlags';
1+
import list from 'api/v1/features/list';
22
import { REACT_QUERY_KEY } from 'constants/reactQueryKeys';
33
import { useQuery, UseQueryResult } from 'react-query';
4+
import { SuccessResponseV2 } from 'types/api';
5+
import APIError from 'types/api/error';
46
import { FeatureFlagProps } from 'types/api/features/getFeaturesFlags';
57

6-
const useGetFeatureFlag = (
8+
export interface Props {
9+
onSuccessHandler: (routes: FeatureFlagProps[]) => void;
10+
isLoggedIn: boolean;
11+
}
12+
type UseGetFeatureFlag = UseQueryResult<
13+
SuccessResponseV2<FeatureFlagProps[]>,
14+
APIError
15+
>;
16+
17+
export const useGetFeatureFlag = (
718
onSuccessHandler: (routes: FeatureFlagProps[]) => void,
819
isLoggedIn: boolean,
9-
): UseQueryResult<FeatureFlagProps[], unknown> =>
10-
useQuery<FeatureFlagProps[]>({
11-
queryFn: getFeaturesFlags,
20+
): UseGetFeatureFlag =>
21+
useQuery<SuccessResponseV2<FeatureFlagProps[]>, APIError>({
1222
queryKey: [REACT_QUERY_KEY.GET_FEATURES_FLAGS],
13-
onSuccess: onSuccessHandler,
23+
queryFn: () => list(),
24+
onSuccess: (data) => {
25+
onSuccessHandler(data.data);
26+
},
1427
retryOnMount: false,
1528
enabled: !!isLoggedIn,
1629
});
17-
18-
export default useGetFeatureFlag;

frontend/src/providers/App/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import getUserVersion from 'api/v1/version/getVersion';
55
import { LOCALSTORAGE } from 'constants/localStorage';
66
import dayjs from 'dayjs';
77
import useActiveLicenseV3 from 'hooks/useActiveLicenseV3/useActiveLicenseV3';
8-
import useGetFeatureFlag from 'hooks/useGetFeatureFlag';
8+
import { useGetFeatureFlag } from 'hooks/useGetFeatureFlag';
99
import { useGlobalEventListener } from 'hooks/useGlobalEventListener';
1010
import useGetUser from 'hooks/user/useGetUser';
1111
import {

0 commit comments

Comments
 (0)