Skip to content
Permalink
Browse files

Create NavBar that uses custom Auth0 hook

  • Loading branch information
ivarprudnikov committed Jan 2, 2020
1 parent 4b0413d commit 07a26fe92b12f5ac1024f2bf964b0744e5e023b2
Showing with 18 additions and 0 deletions.
  1. +18 −0 src/components/NavBar.js
@@ -0,0 +1,18 @@
import React from "react";
import { useAuth0 } from "../react-auth0-spa";

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;

0 comments on commit 07a26fe

Please sign in to comment.
You can’t perform that action at this time.