1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-06-04 01:18:20 +02:00

chore: switch to FeatureSchema

This commit is contained in:
Thomas Heartman 2024-11-20 14:49:37 +01:00
parent d661096fb7
commit b521fafd6b
No known key found for this signature in database
GPG Key ID: BD1F880DAED1EE78

View File

@ -1,12 +1,11 @@
import useSWR, { type SWRConfiguration } from 'swr';
import { useCallback } from 'react';
import { emptyFeature } from './emptyFeature';
import handleErrorResponses from '../httpErrorResponseHandler';
import { formatApiPath } from 'utils/formatPath';
import type { IFeatureToggle } from 'interfaces/featureToggle';
import type { FeatureSchema } from 'openapi';
export interface IUseFeatureOutput {
feature: IFeatureToggle;
feature: FeatureSchema;
refetchFeature: () => void;
loading: boolean;
status?: number;
@ -15,7 +14,7 @@ export interface IUseFeatureOutput {
export interface IFeatureResponse {
status: number;
body?: IFeatureToggle;
body?: FeatureSchema;
}
export const useFeature = (
@ -36,7 +35,7 @@ export const useFeature = (
}, [mutate]);
return {
feature: data?.body || emptyFeature,
feature: data?.body || { name: '' },
refetchFeature,
loading: !error && !data,
status: data?.status,