diff --git a/apps/app/components/project/delete-project-modal.tsx b/apps/app/components/project/delete-project-modal.tsx index 5b271d99d..d6f7ba0f0 100644 --- a/apps/app/components/project/delete-project-modal.tsx +++ b/apps/app/components/project/delete-project-modal.tsx @@ -42,7 +42,7 @@ export const DeleteProjectModal: React.FC = ({ user, }) => { const router = useRouter(); - const { workspaceSlug } = router.query; + const { workspaceSlug, projectId } = router.query; const { setToastAlert } = useToast(); @@ -81,6 +81,8 @@ export const DeleteProjectModal: React.FC = ({ ); if (onSuccess) onSuccess(); + + if (projectId && projectId === data.id) router.push(`/${workspaceSlug}/projects`); }) .catch(() => setToastAlert({ diff --git a/apps/app/pages/[workspaceSlug]/projects/[projectId]/settings/index.tsx b/apps/app/pages/[workspaceSlug]/projects/[projectId]/settings/index.tsx index 4287cee5d..57bf4fa3c 100644 --- a/apps/app/pages/[workspaceSlug]/projects/[projectId]/settings/index.tsx +++ b/apps/app/pages/[workspaceSlug]/projects/[projectId]/settings/index.tsx @@ -183,9 +183,6 @@ const GeneralSettings: NextPage = () => { data={projectDetails ?? null} isOpen={Boolean(selectProject)} onClose={() => setSelectedProject(null)} - onSuccess={() => { - router.push(`/${workspaceSlug}/projects`); - }} user={user} />