Steve Ruiz 4 lat temu
rodzic
commit
d749b1088b
2 zmienionych plików z 6 dodań i 17 usunięć
  1. 0
    9
      pages/api/auth/[...nextauth].ts
  2. 6
    8
      pages/auth-test.tsx

+ 0
- 9
pages/api/auth/[...nextauth].ts Wyświetl plik

@@ -7,15 +7,6 @@ const options = {
7 7
     Providers.GitHub({
8 8
       clientId: process.env.GITHUB_ID,
9 9
       clientSecret: process.env.GITHUB_SECRET,
10
-      profile(profile) {
11
-        return {
12
-          id: profile.id,
13
-          login: profile.login,
14
-          name: profile.name || profile.login,
15
-          email: profile.email,
16
-          image: profile.avatar_url,
17
-        } as any
18
-      },
19 10
     }),
20 11
   ],
21 12
   callbacks: {

+ 6
- 8
pages/auth-test.tsx Wyświetl plik

@@ -49,22 +49,20 @@ export default function Home({
49 49
 }
50 50
 
51 51
 export async function getServerSideProps(context: GetServerSidePropsContext) {
52
-  const session: any = await getSession(context)
52
+  const session = await getSession(context)
53 53
 
54
-  const handle = session?.user?.login
54
+  const image = session?.user?.image
55 55
 
56 56
   const sponsors = await fetch(
57 57
     'https://sponsors.trnck.dev/sponsors/steveruizok'
58 58
   ).then((d) => d.json().then((d) => d.sponsors))
59 59
 
60
-  const sponsor = sponsors.some(
61
-    (sponsor: { handle: string }) => sponsor.handle === handle
62
-  )
60
+  const sponsor = sponsors.some((sponsor: any) => sponsor.avatar === image)
63 61
 
64 62
   console.log(
65
-    session,
66
-    handle,
67
-    sponsors.map((sponsor: any) => sponsor.handle)
63
+    session?.user,
64
+    image,
65
+    sponsors.map((sponsor: any) => sponsor.avatar === image)
68 66
   )
69 67
 
70 68
   return {

Ładowanie…
Anuluj
Zapisz