ticket_manager/client/src/components/Navbar.tsx

18 lines
423 B
TypeScript

import React from "react";
import { useAuth0 } from "../authentication/auth0";
const NavBar = () => {
const { isAuthenticated, loginWithRedirect, logout } = useAuth0();
return (
<div>
{!isAuthenticated && (
<button onClick={() => loginWithRedirect({})}>Log in</button>
)}
{isAuthenticated && <button onClick={() => logout()}>Log out</button>}
</div>
);
};
export default NavBar;