From 15a5234b07a17f8f8ebd20a23ed28df0e8412e1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Ringstr=C3=B6m?= Date: Sun, 19 Jan 2025 12:39:09 +0100 Subject: [PATCH 1/2] Redirects user if deleting person from current Org User gets redirected to the Peoples page if deleting a person from the organization that is currently active --- .../profile/components/PersonOrganizationsCard/index.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/features/profile/components/PersonOrganizationsCard/index.tsx b/src/features/profile/components/PersonOrganizationsCard/index.tsx index c71d66c2e9..e36911c80e 100644 --- a/src/features/profile/components/PersonOrganizationsCard/index.tsx +++ b/src/features/profile/components/PersonOrganizationsCard/index.tsx @@ -18,6 +18,7 @@ import usePersonOrgData from 'features/profile/hooks/usePersonOrgData'; import { ZUIConfirmDialogContext } from 'zui/ZUIConfirmDialogProvider'; import ZUISnackbarContext from 'zui/ZUISnackbarContext'; import messageIds from 'features/profile/l10n/messageIds'; +import { useRouter } from 'next/router'; interface PersonOrganizationsCardProps { orgId: number; @@ -34,6 +35,7 @@ const PersonOrganizationsCard: React.FunctionComponent< const { showConfirmDialog } = useContext(ZUIConfirmDialogContext); const { showSnackbar } = useContext(ZUISnackbarContext); const { data, addToOrg, removeFromOrg } = usePersonOrgData(orgId, personId); + const router = useRouter(); useEffect(() => { if (!editable) { @@ -63,6 +65,9 @@ const PersonOrganizationsCard: React.FunctionComponent< try { await removeFromOrg(subOrgId); setSelected(undefined); + if (orgId == subOrgId) { + router.push(`/organize/${orgId}/people`); + } } catch (err) { showSnackbar('error', messages.organizations.removeError()); } From 981c1db7d732ec4671ee1826583f4e3f906b55b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Ringstr=C3=B6m?= Date: Sun, 19 Jan 2025 14:47:48 +0100 Subject: [PATCH 2/2] Reordered imports --- .../profile/components/PersonOrganizationsCard/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/features/profile/components/PersonOrganizationsCard/index.tsx b/src/features/profile/components/PersonOrganizationsCard/index.tsx index e36911c80e..da3b865b93 100644 --- a/src/features/profile/components/PersonOrganizationsCard/index.tsx +++ b/src/features/profile/components/PersonOrganizationsCard/index.tsx @@ -8,6 +8,7 @@ import { ListItemText, } from '@mui/material'; import { useContext, useEffect, useState } from 'react'; +import { useRouter } from 'next/router'; import OrganizationSelect from './OrganizationSelect'; import { OrganizationsTree } from './OrganizationsTree'; @@ -18,7 +19,6 @@ import usePersonOrgData from 'features/profile/hooks/usePersonOrgData'; import { ZUIConfirmDialogContext } from 'zui/ZUIConfirmDialogProvider'; import ZUISnackbarContext from 'zui/ZUISnackbarContext'; import messageIds from 'features/profile/l10n/messageIds'; -import { useRouter } from 'next/router'; interface PersonOrganizationsCardProps { orgId: number;