Skip to content

Commit

Permalink
Hide camera feed for no bed
Browse files Browse the repository at this point in the history
  • Loading branch information
shyamprakash123 committed Dec 14, 2023
1 parent 08740cd commit adce4da
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions src/Components/Facility/ConsultationDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,16 +120,21 @@ export const ConsultationDetails = (props: any) => {
data.symptoms_text = symptoms.join(", ");
}
setConsultationData(data);
const assetRes = await dispatch(
listAssetBeds({
bed: data?.current_bed?.bed_object?.id,
})
);
const isCameraAttachedRes = assetRes.data.results.some(
(asset: { asset_object: { asset_class: string } }) => {
return asset?.asset_object?.asset_class === "ONVIF";
}
);
const assetRes = data?.current_bed?.bed_object?.id
? await dispatch(
listAssetBeds({
bed: data?.current_bed?.bed_object?.id,
})
)
: null;
const isCameraAttachedRes =
assetRes != null
? assetRes.data.results.some(
(asset: { asset_object: { asset_class: string } }) => {
return asset?.asset_object?.asset_class === "ONVIF";
}
)
: false;
setIsCameraAttached(isCameraAttachedRes);
const id = res.data.patient;
const patientRes = await dispatch(getPatient({ id }));
Expand Down

0 comments on commit adce4da

Please sign in to comment.