Skip to content

Commit 500b362

Browse files
committed
page.tsx and RadarReading update
1 parent 0c9dd64 commit 500b362

2 files changed

Lines changed: 14 additions & 24 deletions

File tree

src/app/auth/signup/page.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { CognitoUserAttribute, CognitoUser,CognitoUserPool, ISignUpResult } from
55
import { userPool } from "../../../utils/cognitoConfig";
66
import AlertMessage from '@/components/AlertMessage';
77

8+
89
export default function Signup() {
910
const [email, setEmail] = useState("");
1011
const [name, setName] = useState("");

src/components/RadarReading.tsx

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,28 @@
1+
"use client";
2+
13
import { useState, useEffect } from "react";
24

35
const RadarReading = () => {
4-
const [token, setToken] = useState("");
6+
const [checkMovement, setCheckMovement] = useState(false);
57

68
useEffect(() => {
7-
setToken(localStorage.getItem("token") || "");
8-
}, []);
9-
10-
const getMembers = async () => {
11-
if (!token) {
12-
console.error("No token found in localStorage");
13-
return;
9+
if (checkMovement) {
10+
// triggerEmailAlert();
1411
}
12+
}, [checkMovement]); // Runs when checkMovement changes
1513

16-
try {
17-
const response = await fetch("/api/triggerEmail", {
18-
method: "GET",
19-
headers: {
20-
"Content-Type": "application/json",
21-
"authorization": `Bearer ${token}`,
22-
},
23-
});
14+
const triggerEmailAlert = async () => {
15+
2416

25-
const data = await response.json();
26-
console.log("Response from the server:", data);
27-
} catch (error) {
28-
console.error("Error fetching members:", error);
29-
}
3017
};
3118

3219
return (
3320
<div className="flex flex-col justify-center items-center shadow-2xl rounded-3xl w-1/2 p-4 border-2 border-blue-200">
34-
<label className="block text-black font-light text-2xl">Radar Reading</label>
35-
<p className="text-blue-600 text-xl">#</p>
36-
21+
<label className="block text-black font-light text-3xl">Radar Reading</label>
22+
<p className="text-blue-600 text-3xl">{checkMovement ? "1" : "0"}</p>
23+
<p className={`text-2xl p-2 rounded-lg ${checkMovement ? "bg-red-200 text-red-600" : "bg-green-100 text-green-400"}`}>
24+
{checkMovement ? "Movement Detected!" : "No Movement Detected!"}
25+
</p>
3726
</div>
3827
);
3928
};

0 commit comments

Comments
 (0)