From f1a788fce10ce7e773349df69ee294b2edd7c875 Mon Sep 17 00:00:00 2001 From: fantasticit Date: Thu, 30 Jun 2022 21:59:14 +0800 Subject: [PATCH] client: filter current organization --- .../organization/switcher/index.tsx | 59 ++++++++++--------- 1 file changed, 31 insertions(+), 28 deletions(-) diff --git a/packages/client/src/components/organization/switcher/index.tsx b/packages/client/src/components/organization/switcher/index.tsx index ee1bab7..2fcf4a1 100644 --- a/packages/client/src/components/organization/switcher/index.tsx +++ b/packages/client/src/components/organization/switcher/index.tsx @@ -11,6 +11,7 @@ import styles from './index.module.scss'; const { Text, Paragraph } = Typography; export const UserOrganizationsSwitcher = () => { + const { organizationId } = useRouterQuery<{ organizationId: string }>(); const { data: userOrganizations, loading: userOrganizationsLoading, @@ -29,34 +30,36 @@ export const UserOrganizationsSwitcher = () => { {userOrganizations.length ? ( <> - {userOrganizations.map((org) => { - return ( - - - - - - {org.name} - - - - - ); - })} + {userOrganizations + .filter((org) => org.id !== organizationId) + .map((org) => { + return ( + + + + + + {org.name} + + + + + ); + })} ) : null}