diff --git a/frontend/hub/collections/hooks/useDeleteCollections.tsx b/frontend/hub/collections/hooks/useDeleteCollections.tsx index d29a2bb315..b25238039d 100644 --- a/frontend/hub/collections/hooks/useDeleteCollections.tsx +++ b/frontend/hub/collections/hooks/useDeleteCollections.tsx @@ -8,7 +8,7 @@ import { useHubBulkConfirmation } from '../../common/useHubBulkConfirmation'; import { PulpItemsResponse } from '../../common/useHubView'; import { CollectionVersionSearch } from '../Collection'; import { useCollectionColumns } from './useCollectionColumns'; -import { navigateAfterDelete } from './useDeleteCollectionsFromRepository'; +import { HubRoute } from '../../main/HubRoutes'; export function useDeleteCollections( onComplete?: (collections: CollectionVersionSearch[]) => void, @@ -33,7 +33,7 @@ export function useDeleteCollections( confirmText += ' ' + - t(`Note that if you selected one collection in multiple repositories, it will be + t(`Note that if you selected one collection in multiple repositories, it will be deleted only once from all repositories.`); const title = version @@ -69,7 +69,7 @@ export function useDeleteCollections( actionFn: (collection: CollectionVersionSearch, signal) => { return deleteCollection(collection, version, signal).then(() => { if (detail) { - return navigateAfterDelete(collection, version || false, navigate); + navigate(HubRoute.Collections); } }); }, diff --git a/frontend/hub/collections/hooks/useDeleteCollectionsFromRepository.tsx b/frontend/hub/collections/hooks/useDeleteCollectionsFromRepository.tsx index 01c0f1f524..0f2876a0c5 100644 --- a/frontend/hub/collections/hooks/useDeleteCollectionsFromRepository.tsx +++ b/frontend/hub/collections/hooks/useDeleteCollectionsFromRepository.tsx @@ -86,7 +86,7 @@ export function useDeleteCollectionsFromRepository( return deleteCollectionFromRepository(newRepository, [collection], version, t).then( () => { if (detail) { - return navigateAfterDelete(collection, version || false, navigate); + navigate(HubRoute.Collections); } } ); @@ -174,22 +174,3 @@ export async function deleteCollectionFromRepository( ); } } - -export function navigateAfterDelete( - collection: CollectionVersionSearch, - version: boolean, - navigate: ReturnType -) { - if (version) { - navigate(HubRoute.CollectionPage, { - query: { - repository: collection.repository?.name || '', - name: collection.collection_version?.name || '', - namespace: collection.collection_version?.namespace || '', - redirectIfEmpty: 'true', - }, - }); - } else { - navigate(HubRoute.Collections); - } -}