Latest stuff
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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>
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user