diff --git a/src/components/Facility/FacilityUsers.tsx b/src/components/Facility/FacilityUsers.tsx index a4af2733d83..fb351a0e603 100644 --- a/src/components/Facility/FacilityUsers.tsx +++ b/src/components/Facility/FacilityUsers.tsx @@ -12,44 +12,47 @@ import UserListView from "@/components/Users/UserListAndCard"; import useFilters from "@/hooks/useFilters"; +import { RESULTS_PER_PAGE_LIMIT } from "@/common/constants"; + import routes from "@/Utils/request/api"; import query from "@/Utils/request/query"; export default function FacilityUsers(props: { facilityId: number }) { const { t } = useTranslation(); const { qParams, updateQuery, Pagination } = useFilters({ - limit: 18, + limit: RESULTS_PER_PAGE_LIMIT, cacheBlacklist: ["username"], }); const [activeTab, setActiveTab] = useState(0); const { facilityId } = props; const { data: userListData, isLoading: userListLoading } = useQuery({ - queryKey: ["facilityUsers", facilityId], + queryKey: ["facilityUsers", facilityId, qParams], queryFn: query(routes.facility.getUsers, { pathParams: { facility_id: facilityId }, + queryParams: { + username: qParams.username, + limit: qParams.limit, + offset: (qParams.page - 1) * qParams.limit, + }, }), enabled: !!facilityId, }); - if (userListLoading) { - return ( -