Skip to content

Instantly share code, notes, and snippets.

@sharad-s
Last active February 25, 2021 06:30
Show Gist options
  • Save sharad-s/0e410fe6ee7128eb235ac5802c9e8aaf to your computer and use it in GitHub Desktop.
Save sharad-s/0e410fe6ee7128eb235ac5802c9e8aaf to your computer and use it in GitHub Desktop.
// Components
import ProfilePage from 'components/Pages/Profile'
import Head from 'next/head'
import { getUserByHandle } from "utils/api/user"
const Profile = ({ user }) => {
console.log({user})
return (
<>
{/*
<Head>
<title>{user.handle}</title>
<meta property="og:title" content={`${user.name}`} key="title" />
<meta name="og:description" content={`${user.name} on Catalog.`}></meta>
<meta property="og:image" content={`${user.picture_uri}`} />
</Head>
*/}
<ProfilePage foundProfile={user} />
</>
)
}
export const getStaticPaths = async () => {
return {
paths: [],
fallback: true,
}
}
export async function getStaticProps({ params }) {
const { handle } = params
try {
const user = await getUserByHandle(handle, { minimal: true })
if (!user) {
return {
props: {},
notFound: true,
revalidate: 10
}
}
return {
props: { user },
notFound: false,
revalidate: 10
}
} catch (err) {
return {
props: {},
revalidate: 10,
notFound: true
}
}
}
export default Profile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment