Skip to content

Commit

Permalink
fix(asset_location): updated fields of response body
Browse files Browse the repository at this point in the history
  • Loading branch information
aeswibon authored and Abhiuday committed Nov 27, 2023
1 parent bc13cad commit c1d6bd6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/Components/Facility/AddLocationForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) || []
);
Expand Down Expand Up @@ -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",
});
Expand Down
8 changes: 3 additions & 5 deletions src/Components/Facility/LocationManagement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Facility/models.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ export interface LocationModel {
name: string;
};

duty_staff_objects?: UserAssignedModel[];
users?: UserAssignedModel[];
}

export interface BedModel {
Expand Down

0 comments on commit c1d6bd6

Please sign in to comment.