From 8863f4a167f3ced22622fc0989a47ae5dd774b1d Mon Sep 17 00:00:00 2001 From: nickviola Date: Tue, 12 Mar 2024 20:38:22 -0500 Subject: [PATCH] Modify getOrgsURL based on user type to filter in frontend/src/components/OrganizationList/OrganizationList.tsx --- .../src/components/OrganizationList/OrganizationList.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/OrganizationList/OrganizationList.tsx b/frontend/src/components/OrganizationList/OrganizationList.tsx index f958bfcf..2af8d919 100644 --- a/frontend/src/components/OrganizationList/OrganizationList.tsx +++ b/frontend/src/components/OrganizationList/OrganizationList.tsx @@ -16,7 +16,14 @@ export const OrganizationList: React.FC<{ const [organizations, setOrganizations] = useState([]); const [dialogOpen, setDialogOpen] = useState(false); const history = useHistory(); - const getOrgsURL = `/v2/organizations/`; + const regionId = user?.regionId; + let getOrgsURL: any; + + if (user?.userType == 'regionalAdmin') { + getOrgsURL = `/organizations/regionId/${regionId}`; + } else { + getOrgsURL = `/v2/organizations/`; + } const orgCols: GridColDef[] = [ { field: 'name', headerName: 'Organization', minWidth: 100, flex: 2 },