Skip to content

Commit

Permalink
fix: redirection after deleting a project
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaryan Khandelwal authored and Aaryan Khandelwal committed Aug 24, 2023
1 parent ab4a17c commit ac5f968
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 3 additions & 1 deletion apps/app/components/project/delete-project-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const DeleteProjectModal: React.FC<TConfirmProjectDeletionProps> = ({
user,
}) => {
const router = useRouter();
const { workspaceSlug } = router.query;
const { workspaceSlug, projectId } = router.query;

const { setToastAlert } = useToast();

Expand Down Expand Up @@ -81,6 +81,8 @@ export const DeleteProjectModal: React.FC<TConfirmProjectDeletionProps> = ({
);

if (onSuccess) onSuccess();

if (projectId && projectId === data.id) router.push(`/${workspaceSlug}/projects`);
})
.catch(() =>
setToastAlert({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,6 @@ const GeneralSettings: NextPage = () => {
data={projectDetails ?? null}
isOpen={Boolean(selectProject)}
onClose={() => setSelectedProject(null)}
onSuccess={() => {
router.push(`/${workspaceSlug}/projects`);
}}
user={user}
/>
<form onSubmit={handleSubmit(onSubmit)} className="p-8">
Expand Down

0 comments on commit ac5f968

Please sign in to comment.