Skip to content

Instantly share code, notes, and snippets.

@ByteCrak07
Created March 7, 2023 11:36
Show Gist options
  • Save ByteCrak07/354b61e37304c70fb8965dbe1817a8c1 to your computer and use it in GitHub Desktop.
Save ByteCrak07/354b61e37304c70fb8965dbe1817a8c1 to your computer and use it in GitHub Desktop.
import Head from "next/head";
import { NextPage } from "next";
import Link from "next/link";
import { usePbAuth } from "../contexts/AuthWrapper";
const Home: NextPage = () => {
const { user, signOut } = usePbAuth();
return (
<>
<Head>
<title>Home page</title>
</Head>
<main>
{!user ? (
<Link href="/signin">Sign In page</Link>
) : (
<>
<h1>{user.name}</h1>
<p>
<img src={user.avatarUrl} width={50} alt="avatar" />
</p>
<p>Username: {user.username}</p>
<p>Email: {user.email}</p>
<button onClick={signOut}>Sign Out</button>
</>
)}
</main>
</>
);
};
export default Home;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment