more auth

This commit is contained in:
Steve Ruiz 2021-06-19 19:58:52 +01:00
parent fdf82d3a91
commit d749b1088b
2 changed files with 6 additions and 17 deletions

View file

@ -7,15 +7,6 @@ const options = {
Providers.GitHub({
clientId: process.env.GITHUB_ID,
clientSecret: process.env.GITHUB_SECRET,
profile(profile) {
return {
id: profile.id,
login: profile.login,
name: profile.name || profile.login,
email: profile.email,
image: profile.avatar_url,
} as any
},
}),
],
callbacks: {

View file

@ -49,22 +49,20 @@ export default function Home({
}
export async function getServerSideProps(context: GetServerSidePropsContext) {
const session: any = await getSession(context)
const session = await getSession(context)
const handle = session?.user?.login
const image = session?.user?.image
const sponsors = await fetch(
'https://sponsors.trnck.dev/sponsors/steveruizok'
).then((d) => d.json().then((d) => d.sponsors))
const sponsor = sponsors.some(
(sponsor: { handle: string }) => sponsor.handle === handle
)
const sponsor = sponsors.some((sponsor: any) => sponsor.avatar === image)
console.log(
session,
handle,
sponsors.map((sponsor: any) => sponsor.handle)
session?.user,
image,
sponsors.map((sponsor: any) => sponsor.avatar === image)
)
return {