From f7733a59f4c8dc155074bbc61ac681f4c563ff9f Mon Sep 17 00:00:00 2001
From: Andrew <74398819+AndrewDTR@users.noreply.github.com>
Date: Mon, 23 Sep 2024 21:56:41 -0500
Subject: [PATCH] add "check our hours" when doors closed
---
src/components/DoorStatus.jsx | 55 ++++++++++++++------------
src/components/Header.astro | 74 ++++++++++++-----------------------
2 files changed, 55 insertions(+), 74 deletions(-)
diff --git a/src/components/DoorStatus.jsx b/src/components/DoorStatus.jsx
index ddb4076..42760b6 100644
--- a/src/components/DoorStatus.jsx
+++ b/src/components/DoorStatus.jsx
@@ -11,7 +11,7 @@ const DoorStatus = () => {
const data = await response.json();
const { door1, door2 } = data.status;
- // determine if the UPL is open
+ // Determine if the UPL is open
if (door1 === "open" && door2 === "open") {
setIsOpen(true);
} else {
@@ -19,40 +19,45 @@ const DoorStatus = () => {
}
} catch (error) {
console.error("Error fetching door status:", error);
- setIsOpen(false); // default to closed
+ setIsOpen(false); // Default to closed
}
};
useEffect(() => {
fetchDoorStatus();
- const interval = setInterval(fetchDoorStatus, 500); // fetch every 10 seconds
+ const interval = setInterval(fetchDoorStatus, 10000); // Fetch every 10 seconds
return () => clearInterval(interval);
}, []);
return (
-
-
+ The doors are{" "}
+
+ {isOpen === null ? "loading..." : isOpen ? "open" : "closed"}
+
+ !
+
- The doors are{" "}
-
- {isOpen === null ? "loading..." : isOpen ? "open" : "closed"}
-
- !
-