|
|
@@ -51,17 +51,19 @@ export default function Home({
|
|
51
|
51
|
export async function getServerSideProps(context: GetServerSidePropsContext) {
|
|
52
|
52
|
const session = await getSession(context)
|
|
53
|
53
|
|
|
|
54
|
+ const id = session?.user?.image.match(/u\/(.*)\?/)?.[1]
|
|
|
55
|
+
|
|
54
|
56
|
const sponsors = await fetch(
|
|
55
|
57
|
'https://sponsors.trnck.dev/sponsors/steveruizok'
|
|
56
|
58
|
).then((d) => d.json().then((d) => d.sponsors))
|
|
57
|
59
|
|
|
58
|
|
- const sponsor = sponsors.find(
|
|
59
|
|
- (sponsor: { avatar: string }) => sponsor.avatar === session?.user?.image
|
|
|
60
|
+ const sponsor = sponsors.find((sponsor: { avatar: string }) =>
|
|
|
61
|
+ sponsor.avatar.includes(id)
|
|
60
|
62
|
)
|
|
61
|
63
|
|
|
62
|
64
|
console.log(
|
|
63
|
65
|
session?.user,
|
|
64
|
|
- session?.user?.image,
|
|
|
66
|
+ id,
|
|
65
|
67
|
sponsors.map((sponsor: any) => sponsor.avatar)
|
|
66
|
68
|
)
|
|
67
|
69
|
|