rsnext/examples/auth0/pages/index.js
Joe Haddad 18a9c7e371
Improve linting rules to catch more errors (#9374)
* Update `packages/`

* Update examples

* Update tests

* Update bench

* Update top level files

* Fix build

* trigger
2019-11-10 19:24:53 -08:00

39 lines
886 B
JavaScript

import React from 'react'
import Layout from '../components/layout'
import { useFetchUser } from '../lib/user'
function Home() {
const { user, loading } = useFetchUser()
return (
<Layout user={user} loading={loading}>
<h1>Next.js and Auth0 Example</h1>
{loading && <p>Loading login info...</p>}
{!loading && !user && (
<>
<p>
To test the login click in <i>Login</i>
</p>
<p>
Once you have logged in you should be able to click in{' '}
<i>Profile</i> 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>
)
}
export default Home