fix: redirection after deleting a project (#1970)

Co-authored-by: Aaryan Khandelwal <aaryan610@Aaryans-MacBook-Pro.local>
This commit is contained in:
Aaryan Khandelwal 2023-08-25 12:17:17 +05:30 committed by GitHub
parent fe1b0c1d73
commit bf0d0503b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 4 deletions

View File

@ -42,7 +42,7 @@ export const DeleteProjectModal: React.FC<TConfirmProjectDeletionProps> = ({
user, user,
}) => { }) => {
const router = useRouter(); const router = useRouter();
const { workspaceSlug } = router.query; const { workspaceSlug, projectId } = router.query;
const { setToastAlert } = useToast(); const { setToastAlert } = useToast();
@ -81,6 +81,8 @@ export const DeleteProjectModal: React.FC<TConfirmProjectDeletionProps> = ({
); );
if (onSuccess) onSuccess(); if (onSuccess) onSuccess();
if (projectId && projectId === data.id) router.push(`/${workspaceSlug}/projects`);
}) })
.catch(() => .catch(() =>
setToastAlert({ setToastAlert({

View File

@ -183,9 +183,6 @@ const GeneralSettings: NextPage = () => {
data={projectDetails ?? null} data={projectDetails ?? null}
isOpen={Boolean(selectProject)} isOpen={Boolean(selectProject)}
onClose={() => setSelectedProject(null)} onClose={() => setSelectedProject(null)}
onSuccess={() => {
router.push(`/${workspaceSlug}/projects`);
}}
user={user} user={user}
/> />
<form onSubmit={handleSubmit(onSubmit)} className="p-8"> <form onSubmit={handleSubmit(onSubmit)} className="p-8">