Skip to content

Commit

Permalink
remove the code that does not work
Browse files Browse the repository at this point in the history
  • Loading branch information
IanHollow committed May 13, 2024
1 parent 7b3feda commit 923db55
Showing 1 changed file with 1 addition and 51 deletions.
52 changes: 1 addition & 51 deletions app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function ButtonLink(props: any) {
);
}

function Home() {
export default function Home() {
const [dhs, setDhs] = useState<DiningHall[]>([]);
const [dhs_names, set_dhs_names] = useState([""]);
const [searchInput, setSearchInput] = useState("");
Expand Down Expand Up @@ -149,7 +149,6 @@ function Home() {
</h2>

<h3 className="w-full">

<ul className="">
{dhs.map((dh, i) => (
<li key={i}>
Expand All @@ -163,52 +162,3 @@ function Home() {
</main>
);
}

export default function Page() {
const [user, setUser] = useState<User | null>(null);

useEffect(() => {
console.log(
"Page component loaded and GoogleOAuthProvider should be active",
);
}, []);

const handleLogout = () => {
googleLogout();
setUser(null); // Clear user state on logout
console.log("Logout Successful");
};

const handleLoginSuccess = (credentialResponse: any) => {
console.log("Login Successful", credentialResponse);
const decoded: User = jwtDecode(credentialResponse.credential);
setUser({
name: decoded.name,
picture: decoded.picture,
});
};

return (
<GoogleOAuthProvider clientId="1040494859138-vji3ddfil5jancg23ifaginvmn71hktf.apps.googleusercontent.com">
<Home />
<GoogleLogin
onSuccess={handleLoginSuccess}
onError={() => {
console.log("Login Failed");
}}
/>
{user && (
<div>
<img src={user.picture} alt="User profile" />
<h2>{user.name}</h2>
</div>
)}
<button
onClick={handleLogout}
className="p-2 mt-2 text-white bg-red-600 rounded"
>
Logout
</button>
</GoogleOAuthProvider>
);
}

0 comments on commit 923db55

Please sign in to comment.