diff --git a/frontend/src/hooks/api/getters/useStrategies/useStrategies.ts b/frontend/src/hooks/api/getters/useStrategies/useStrategies.ts index c1d005e560..5964227c30 100644 --- a/frontend/src/hooks/api/getters/useStrategies/useStrategies.ts +++ b/frontend/src/hooks/api/getters/useStrategies/useStrategies.ts @@ -6,13 +6,29 @@ import handleErrorResponses from '../httpErrorResponseHandler'; export const STRATEGIES_CACHE_KEY = 'api/admin/strategies'; +const flexibleRolloutStrategy: IStrategy = { + deprecated: false, + name: 'flexibleRollout', + displayName: 'Gradual rollout', + editable: false, + description: 'Roll out to a percentage of your userbase, and ensure that the experience is the same for the user on each visit.', + parameters: [{ + name: 'rollout', type: 'percentage', description: '', required: false + }, { + name: 'stickiness', + type: 'string', + description: 'Used to defined stickiness', + required: true + }, { name: 'groupId', type: 'string', description: '', required: true }] +}; + const useStrategies = () => { const fetcher = () => { const path = formatApiPath(`api/admin/strategies`); return fetch(path, { method: 'GET', - credentials: 'include', + credentials: 'include' }).then(handleErrorResponses('Strategies')).then(res => res.json()); }; @@ -31,10 +47,10 @@ const useStrategies = () => { }, [data, error]); return { - strategies: data?.strategies || [], + strategies: data?.strategies || [flexibleRolloutStrategy], error, loading, - refetch, + refetch }; };