mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-25 00:07:47 +01:00
Add default strategy type to strategy hook
- Fixes the missing sidebar while loading the strategy types Trello: https://trello.com/c/WJk8bI8l/490-feature-strategies-loading-state
This commit is contained in:
parent
d42d412bc8
commit
6d42502792
@ -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
|
||||
};
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user