Skip to content

Commit

Permalink
Settting up logout
Browse files Browse the repository at this point in the history
  • Loading branch information
4rjunc committed Mar 4, 2024
1 parent 02fb92b commit 9c788b7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { GoogleOAuthProvider } from "@react-oauth/google";
function App() {
return (
<>
<GoogleOAuthProvider clientId="791186457310-ia4gebdepqh4h8g9ci1n85e36tg8jlrm.apps.googleusercontent.com">
<GoogleOAuthProvider clientId="791186457310-61ggudu64h8i3t0p70an06b0mik2b0pa.apps.googleusercontent.com">
<Login />
</GoogleOAuthProvider>
;
Expand Down
10 changes: 8 additions & 2 deletions src/components/Navbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,28 @@ import Tooltip from "@mui/material/Tooltip";
import MenuItem from "@mui/material/MenuItem";
import AdbIcon from "@mui/icons-material/Adb";
import turtleLogo from "/turtle.png";
import { googleLogout } from "@react-oauth/google";

const settings = ["Logout"];

const Navbar = (props) => {
const [anchorElUser, setAnchorElUser] = React.useState(null);


const handleOpenUserMenu = (event) => {
setAnchorElUser(event.currentTarget);
};

console.log("User", props.user)
console.log("User", props.user);

const handleCloseUserMenu = () => {
setAnchorElUser(null);
};

const handleLogout = () => {
googleLogout();
console.log("Logout");
};

return (
<AppBar position="static" sx={{ bgcolor: "#242424" }}>
<Container maxWidth="xl">
Expand Down Expand Up @@ -96,6 +101,7 @@ const Navbar = (props) => {
>
{settings.map((setting) => (
<MenuItem key={setting} onClick={handleCloseUserMenu}>
<Button onClick={handleLogout}>HELLO</Button>
<Typography textAlign="center">{setting}</Typography>
</MenuItem>
))}
Expand Down

0 comments on commit 9c788b7

Please sign in to comment.