Update auth-test.tsx
This commit is contained in:
parent
22eaf217da
commit
00fe07c6c3
1 changed files with 5 additions and 3 deletions
|
@ -51,17 +51,19 @@ export default function Home({
|
||||||
export async function getServerSideProps(context: GetServerSidePropsContext) {
|
export async function getServerSideProps(context: GetServerSidePropsContext) {
|
||||||
const session = await getSession(context)
|
const session = await getSession(context)
|
||||||
|
|
||||||
|
const id = session?.user?.image.match(/u\/(.*)\?/)?.[1]
|
||||||
|
|
||||||
const sponsors = await fetch(
|
const sponsors = await fetch(
|
||||||
'https://sponsors.trnck.dev/sponsors/steveruizok'
|
'https://sponsors.trnck.dev/sponsors/steveruizok'
|
||||||
).then((d) => d.json().then((d) => d.sponsors))
|
).then((d) => d.json().then((d) => d.sponsors))
|
||||||
|
|
||||||
const sponsor = sponsors.find(
|
const sponsor = sponsors.find((sponsor: { avatar: string }) =>
|
||||||
(sponsor: { avatar: string }) => sponsor.avatar === session?.user?.image
|
sponsor.avatar.includes(id)
|
||||||
)
|
)
|
||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
session?.user,
|
session?.user,
|
||||||
session?.user?.image,
|
id,
|
||||||
sponsors.map((sponsor: any) => sponsor.avatar)
|
sponsors.map((sponsor: any) => sponsor.avatar)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue