From c1d6bd63ab26227d39c326a35494208d2b1281a7 Mon Sep 17 00:00:00 2001 From: Abhiuday Date: Fri, 17 Nov 2023 18:40:04 +0530 Subject: [PATCH] fix(asset_location): updated fields of response body --- src/Components/Facility/AddLocationForm.tsx | 6 +++--- src/Components/Facility/LocationManagement.tsx | 8 +++----- src/Components/Facility/models.tsx | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/Components/Facility/AddLocationForm.tsx b/src/Components/Facility/AddLocationForm.tsx index 44dd5024d1b..1f8d86e1f54 100644 --- a/src/Components/Facility/AddLocationForm.tsx +++ b/src/Components/Facility/AddLocationForm.tsx @@ -82,12 +82,12 @@ export const AddLocationForm = (props: LocationFormProps) => { setDescription(res?.data?.description || ""); setMiddlewareAddress(res?.data?.middleware_address || ""); setDoctors( - res?.data?.duty_staff_objects + res?.data?.users .filter((doc: UserAssignedModel) => doc.user_type === "Doctor") .map((doc: UserAssignedModel) => doc.id) || [] ); setStaff( - res?.data?.duty_staff_objects + res?.data?.users .filter((s: UserAssignedModel) => s.user_type === "Staff") .map((s: UserAssignedModel) => s.id) || [] ); @@ -155,7 +155,7 @@ export const AddLocationForm = (props: LocationFormProps) => { res.data.id ) ); - if (duty_res.status === 200) { + if (duty_res.status === 201) { Notification.Success({ msg: "Duty Staff assigned successfully", }); diff --git a/src/Components/Facility/LocationManagement.tsx b/src/Components/Facility/LocationManagement.tsx index ad712ddc70f..8c10457942b 100644 --- a/src/Components/Facility/LocationManagement.tsx +++ b/src/Components/Facility/LocationManagement.tsx @@ -72,12 +72,10 @@ const Location = ({ description, middleware_address, id, - duty_staff_objects, + users, }: LocationModel) => { - const doctors = - duty_staff_objects?.filter((u) => u.user_type === "Doctor") || []; - const staffs = - duty_staff_objects?.filter((u) => u.user_type === "Staff") || []; + const doctors = users?.filter((u) => u.user_type === "Doctor") || []; + const staffs = users?.filter((u) => u.user_type === "Staff") || []; const { t } = useTranslation(); return ( diff --git a/src/Components/Facility/models.tsx b/src/Components/Facility/models.tsx index d1f9e2fa6cc..0f0d9b967a5 100644 --- a/src/Components/Facility/models.tsx +++ b/src/Components/Facility/models.tsx @@ -207,7 +207,7 @@ export interface LocationModel { name: string; }; - duty_staff_objects?: UserAssignedModel[]; + users?: UserAssignedModel[]; } export interface BedModel {