1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-09-24 17:51:14 +02:00
unleash.unleash/frontend/src/component/feature/RedirectFeatureView/RedirectFeatureView.tsx
Fredrik Strand Oseberg 728477e238 Feat/feature routes (#327)
* fix: setup new routes

* fix: copy toggle

* fix: link to correct project

* fix: redirect oss to default

* fix: update tests

* fix: edit path

* fix: remove invalid property

* fix: add project to test data

* fix: update paths to use features

* fix: update test data

* fix: update snapshots

* fix: only show button to add toggle if you have access

* fix: change heading

* fix: use new route

* fix: archive view

* fix: update snapshots

* fix: sorting headers

* fix: list headers

* fix: only show span if revive is present

* fix: add border to list

* fix: update snapshots

* fix: remove console log
2021-08-25 13:37:22 +02:00

31 lines
730 B
TypeScript

import { useEffect } from 'react';
import { Redirect } from 'react-router-dom';
import { getTogglePath } from '../../../utils/route-path-helpers';
interface IRedirectFeatureViewProps {
featureToggle: any;
features: any;
fetchFeatureToggles: () => void;
}
const RedirectFeatureView = ({
featureToggle,
fetchFeatureToggles,
}: IRedirectFeatureViewProps) => {
useEffect(() => {
if (!featureToggle) {
fetchFeatureToggles();
}
/* eslint-disable-next-line */
}, []);
if (!featureToggle) return null;
return (
<Redirect
to={getTogglePath(featureToggle?.project, featureToggle?.name)}
/>
);
};
export default RedirectFeatureView;