Skip to content

Commit

Permalink
fix(frontend): fix delete resource navigation (#3647)
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgeepc committed Feb 15, 2024
1 parent 8177c8b commit 2ab2779
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion web/src/hooks/useDeleteResource.tsx
Expand Up @@ -20,18 +20,21 @@ const useDeleteResource = () => {
const onConfirmDelete = useCallback(
async (id: string, type: ResourceType) => {
try {
let path = '/tests';
if (type === ResourceType.Test) {
TestAnalyticsService.onDeleteTest();
await deleteTestMutation({testId: id}).unwrap();
} else if (type === ResourceType.TestSuite) {
path = '/testsuites';
await deleteTestSuiteMutation({testSuiteId: id}).unwrap();
}

showNotification({
type: 'success',
title: `${capitalize(type)} deleted successfully`,
});
navigate('/');

navigate(path);
} catch (error) {
showNotification({
type: 'error',
Expand Down

0 comments on commit 2ab2779

Please sign in to comment.