From 4fb718cd3653513fa0265290ca12767ce8578447 Mon Sep 17 00:00:00 2001 From: Shaurya Gupta Date: Sat, 7 Dec 2024 19:13:19 +0530 Subject: [PATCH] Fix setTotalDoctors in FacilityStaffList --- src/components/Facility/FacilityStaffList.tsx | 4 ++-- src/components/Facility/models.tsx | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/Facility/FacilityStaffList.tsx b/src/components/Facility/FacilityStaffList.tsx index 5cc67927a4c..e14e92e029f 100644 --- a/src/components/Facility/FacilityStaffList.tsx +++ b/src/components/Facility/FacilityStaffList.tsx @@ -32,8 +32,8 @@ export const FacilityStaffList = (props: any) => { offset: (qParams.page - 1) * resultsPerPage, }, onResponse: ({ res, data }) => { - if (res?.ok && data) { - setTotalDoctors(data?.total_doctors ?? 0); + if (res?.ok && data?.results.length) { + setTotalDoctors(data.results[0]?.total_doctors ?? 0); } }, }); diff --git a/src/components/Facility/models.tsx b/src/components/Facility/models.tsx index a984efe6283..06400f0df74 100644 --- a/src/components/Facility/models.tsx +++ b/src/components/Facility/models.tsx @@ -127,6 +127,7 @@ export interface DoctorModal { id?: number; area?: number; count?: number; + total_doctors?: number; } export interface OptionsType {