Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix : Facility name in facility users page #9746

Merged
merged 4 commits into from
Jan 4, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 2 additions & 17 deletions src/components/Facility/FacilityUsers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import useFilters from "@/hooks/useFilters";

import routes from "@/Utils/request/api";
import query from "@/Utils/request/query";
import useTanStackQueryInstead from "@/Utils/request/useQuery";

export default function FacilityUsers(props: { facilityId: number }) {
const { t } = useTranslation();
Expand All @@ -22,16 +21,6 @@ export default function FacilityUsers(props: { facilityId: number }) {
const [activeTab, setActiveTab] = useState(0);
const { facilityId } = props;

const { data: facilityData } = useTanStackQueryInstead(
routes.getAnyFacility,
{
pathParams: {
id: facilityId,
},
prefetch: facilityId !== undefined,
},
);

const { data: userListData, isLoading: userListLoading } = useQuery({
queryKey: ["facilityUsers", facilityId],
queryFn: query(routes.facility.getUsers, {
Expand All @@ -44,15 +33,11 @@ export default function FacilityUsers(props: { facilityId: number }) {
return <div>Loading...</div>;
}
if (!userListData) {
return <div>No users found</div>;
return <div>{t("no_users_found")}</div>;
}

return (
<Page
title={`${t("users")} - ${facilityData?.name}`}
hideBack={true}
breadcrumbs={false}
>
<Page title={`${t("users")}`} hideBack={true} breadcrumbs={false}>
<CountBlock
text={t("total_users")}
count={userListData.count}
Expand Down
Loading