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

fix: render new link if enabled

This commit is contained in:
Ivar Conradi Østhus 2021-10-01 19:38:34 +02:00
parent b3f099c034
commit 0dd3ada1ee
2 changed files with 6 additions and 3 deletions

View File

@ -15,6 +15,7 @@ import ConditionallyRender from '../../../common/ConditionallyRender';
import useToast from '../../../../hooks/useToast'; import useToast from '../../../../hooks/useToast';
import { getTogglePath } from '../../../../utils/route-path-helpers'; import { getTogglePath } from '../../../../utils/route-path-helpers';
import { SyntheticEvent } from 'react-router/node_modules/@types/react'; import { SyntheticEvent } from 'react-router/node_modules/@types/react';
import useUiConfig from '../../../../hooks/api/getters/useUiConfig/useUiConfig';
interface IFeatureToggleListNewItemProps { interface IFeatureToggleListNewItemProps {
name: string; name: string;
@ -36,6 +37,8 @@ const FeatureToggleListNewItem = ({
projectId, projectId,
name name
); );
const { uiConfig } = useUiConfig();
const styles = useStyles(); const styles = useStyles();
const history = useHistory(); const history = useHistory();
@ -43,7 +46,7 @@ const FeatureToggleListNewItem = ({
const onClick = (e: SyntheticEvent) => { const onClick = (e: SyntheticEvent) => {
if (!ref.current?.contains(e.target)) { if (!ref.current?.contains(e.target)) {
history.push(getTogglePath(projectId, name)); history.push(getTogglePath(projectId, name, uiConfig.flags.E));
} }
}; };

View File

@ -1,5 +1,5 @@
export const getTogglePath = (projectId: string, featureToggleName: string) => { export const getTogglePath = (projectId: string, featureToggleName: string, newPath: boolean) => {
return `/projects/${projectId}/features/${featureToggleName}/strategies`; return `/projects/${projectId}/features${newPath ? '2' : ''}/${featureToggleName}/strategies`;
}; };
export const getToggleCopyPath = ( export const getToggleCopyPath = (