Last active
February 25, 2021 06:30
-
-
Save jarbacoa/0e410fe6ee7128eb235ac5802c9e8aaf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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