Latest stuff

This commit is contained in:
2021-11-30 18:40:18 -06:00
parent 58b62ee47c
commit 3742b86cf7
2 changed files with 11 additions and 6 deletions

View File

@@ -2,9 +2,11 @@ import React from "react";
import { useAuth0 } from "@auth0/auth0-react";
const LoginButton = () => {
const { loginWithRedirect } = useAuth0();
const { loginWithRedirect, isAuthenticated } = useAuth0();
return <button onClick={() => loginWithRedirect()}>Log In</button>;
return (
!isAuthenticated && <button onClick={() => loginWithRedirect()}>Log In</button>
);
};
export default LoginButton;

View File

@@ -2,12 +2,15 @@ import React from "react";
import { useAuth0 } from "@auth0/auth0-react";
const LogoutButton = () => {
const { logout } = useAuth0();
const { logout, isAuthenticated } = useAuth0();
return (
<button onClick={() => logout({ returnTo: window.location.origin })}>
Log Out
</button>
(
isAuthenticated &&
<button onClick={() => logout({ returnTo: window.location.origin })}>
Log Out
</button>
)
);
};