feat(auth0) add onClick prop to Button tag

This commit is contained in:
dancingCycle 2022-07-18 18:20:15 +02:00
parent ea29090eee
commit 2f495ba51c
2 changed files with 24 additions and 6 deletions

View File

@ -1,9 +1,18 @@
import { useAuth0 } from '@auth0/auth0-react';
import React from 'react'; import React from 'react';
function LoginButton(props) { function LoginButton(props) {
const { loginWithRedirect } = useAuth0()
return ( return (
<div> <div>
<button className="loginButton">Login</button> <button
onClick={()=>loginWithRedirect()}
className="loginButton"
>
Login
</button>
</div> </div>
); )
}; }
export default LoginButton; export default LoginButton;

View File

@ -1,9 +1,18 @@
import { useAuth0 } from '@auth0/auth0-react';
import React from 'react'; import React from 'react';
function LogoutButton(props) { function LogoutButton(props) {
const { loginWithRedirect } = useAuth0()
return ( return (
<div> <div>
<button className="loginButton">Logout</button> <button
onClick={()=>loginWithRedirect()}
className="loginButton"
>
Logout
</button>
</div> </div>
); )
}; }
export default LogoutButton; export default LogoutButton;