mirror of
https://github.com/apricote/Listory.git
synced 2026-01-13 21:21:02 +00:00
27 lines
669 B
JavaScript
27 lines
669 B
JavaScript
import React from "react";
|
|
import { useAuth0 } from "../react-auth0-spa";
|
|
import { Link } from "react-router-dom";
|
|
|
|
const NavBar = () => {
|
|
const { isAuthenticated, loginWithRedirect, logout } = useAuth0();
|
|
|
|
return (
|
|
<div>
|
|
{!isAuthenticated && (
|
|
<button onClick={() => loginWithRedirect({})}>Log in</button>
|
|
)}
|
|
|
|
{isAuthenticated && <button onClick={() => logout()}>Log out</button>}
|
|
|
|
{isAuthenticated && (
|
|
<span>
|
|
<Link to="/">Home</Link>
|
|
<Link to="/profile">Profile</Link>
|
|
<Link to="/external-api">External API</Link>
|
|
</span>
|
|
)}
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default NavBar;
|