Skip to content

Commit

Permalink
Add clock and error message
Browse files Browse the repository at this point in the history
  • Loading branch information
am9zZWY committed Jun 28, 2024
1 parent 0c62cf0 commit 63e071f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/app/admin/prepare/page.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ const Page = () => {
.catch(error => setError(error.message));
};

useEffect(() => {
const timer = setInterval(() => {
setCurrentTime(new Date());
}, 1000);

return () => clearInterval(timer); // Cleanup timer on component unmount
}, []);

useEffect(() => {
if (isClient) {
const timer = setInterval(() => {
Expand Down Expand Up @@ -113,6 +121,11 @@ const Page = () => {
<div>
<div className="p-4">
<h2 className="text-2xl mb-4">Food Pipeline 🍕</h2>
<h3 className="text-lg mb-2">Current Time: {currentTime.toLocaleTimeString()}</h3>
</div>

<div>
{error && <ErrorMessage error={error}/>}
</div>

<div className="flex flex-col space-y-2">
Expand Down

0 comments on commit 63e071f

Please sign in to comment.