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