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"; import { useAuth0 } from "@auth0/auth0-react";
const LoginButton = () => { 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; export default LoginButton;

View File

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