File size: 971 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
import { useUser } from "@auth0/nextjs-auth0/client";
import Layout from "../components/layout";
const Home = () => {
const { user, isLoading } = useUser();
return (
<Layout user={user} loading={isLoading}>
<h1>Next.js and Auth0 Example</h1>
{isLoading && <p>Loading login info...</p>}
{!isLoading && !user && (
<>
<p>
To test the login click in <i>Login</i>
</p>
<p>
Once you have logged in you should be able to navigate between
protected routes: client rendered, server rendered profile pages,
and <i>Logout</i>
</p>
</>
)}
{user && (
<>
<h4>Rendered user info on the client</h4>
<img src={user.picture} alt="user picture" />
<p>nickname: {user.nickname}</p>
<p>name: {user.name}</p>
</>
)}
</Layout>
);
};
// fast/cached SSR page
export default Home;
|