diff --git a/src/views/routes/actions/hooks/useRouteActions.ts b/src/views/routes/actions/hooks/useRouteActions.ts index c23a6e55..7caf1f95 100644 --- a/src/views/routes/actions/hooks/useRouteActions.ts +++ b/src/views/routes/actions/hooks/useRouteActions.ts @@ -1,4 +1,4 @@ -import { useHistory } from 'react-router'; +import { useNavigate } from 'react-router-dom-v5-compat'; import { modelToRef, RouteModel } from '@kubevirt-ui/kubevirt-api/console'; import { @@ -16,7 +16,7 @@ type UseRouteActions = (route: RouteKind) => [actions: Action[]]; const useRouteActions: UseRouteActions = (route) => { const { t } = useNetworkingTranslation(); - const history = useHistory(); + const navigate = useNavigate(); const launchDeleteModal = useDeleteModal(route); const launchLabelsModal = useLabelsModal(route); const launchAnnotationsModal = useAnnotationsModal(route); @@ -39,8 +39,7 @@ const useRouteActions: UseRouteActions = (route) => { }, { accessReview: asAccessReview(RouteModel, route, 'update'), - cta: () => - history.push(`/k8s/ns/${routeNamespace}/${modelToRef(RouteModel)}/${routeName}/form`), + cta: () => navigate(`/k8s/ns/${routeNamespace}/${modelToRef(RouteModel)}/${routeName}/form`), id: 'edit-routes', label: t('Edit Route'), }, diff --git a/src/views/services/actions/hooks/useServiceActions.tsx b/src/views/services/actions/hooks/useServiceActions.tsx index 912e92a8..bc6e563d 100644 --- a/src/views/services/actions/hooks/useServiceActions.tsx +++ b/src/views/services/actions/hooks/useServiceActions.tsx @@ -1,4 +1,4 @@ -import { useHistory } from 'react-router'; +import { useNavigate } from 'react-router-dom-v5-compat'; import { modelToRef, ServiceModel } from '@kubevirt-ui/kubevirt-api/console'; import { IoK8sApiCoreV1Service } from '@kubevirt-ui/kubevirt-api/kubernetes/models'; @@ -20,7 +20,7 @@ type ServiceActionProps = (obj: IoK8sApiCoreV1Service) => [actions: Action[]]; const useServiceActions: ServiceActionProps = (obj) => { const { t } = useNetworkingTranslation(); - const history = useHistory(); + const navigate = useNavigate(); const launchDeleteModal = useDeleteModal(obj); const launchLabelsModal = useLabelsModal(obj); const launchAnnotationsModal = useAnnotationsModal(obj); @@ -54,8 +54,7 @@ const useServiceActions: ServiceActionProps = (obj) => { }, { accessReview: asAccessReview(ServiceModel, obj, 'update'), - cta: () => - history.push(`/k8s/ns/${objNamespace}/${modelToRef(ServiceModel)}/${objName}/yaml`), + cta: () => navigate(`/k8s/ns/${objNamespace}/${modelToRef(ServiceModel)}/${objName}/yaml`), id: 'edit-services', label: t('Edit Service'), },