diff --git a/src/components/DoorStatus.jsx b/src/components/DoorStatus.jsx index dce52d8..561e0b7 100644 --- a/src/components/DoorStatus.jsx +++ b/src/components/DoorStatus.jsx @@ -14,12 +14,10 @@ const DoorStatus = () => { const backDoor = data.find((door) => door.door === "back"); const frontDoor = data.find((door) => door.door === "front"); - if (backDoor?.status === "on" && frontDoor?.status === "on") { - setIsOpen(true); - } else if (backDoor?.status === "off" && frontDoor?.status === "off") { + if (backDoor?.status === "off" || frontDoor?.status === "off") { setIsOpen(false); - } else { - setIsOpen(null); + } else if (backDoor?.status === "on" && frontDoor?.status === "on") { + setIsOpen(true); } } catch (error) { console.error("Error fetching door status:", error); @@ -78,4 +76,4 @@ const DoorStatus = () => { ); }; -export default DoorStatus; +export default DoorStatus; \ No newline at end of file