File tree Expand file tree Collapse file tree 3 files changed +11
-10
lines changed
Expand file tree Collapse file tree 3 files changed +11
-10
lines changed Original file line number Diff line number Diff line change 33import Image from "next/image" ;
44import { useRouter } from "next/navigation" ;
55import { useEffect , useState } from "react" ;
6+ import { authHeaders } from "@/config/header" ;
67import { client } from "@/lib/client" ;
78
89export default function AuthCallback ( ) {
@@ -12,7 +13,7 @@ export default function AuthCallback() {
1213 const [ userInfo , setUserInfo ] = useState < {
1314 id : string ;
1415 email : string ;
15- username : string ;
16+ name : string ;
1617 avatar_url ?: string ;
1718 } | null > ( null ) ;
1819
@@ -47,8 +48,7 @@ export default function AuthCallback() {
4748 } ,
4849 {
4950 headers : {
50- "Content-Type" : "application/json" ,
51- credentials : "include" ,
51+ ...authHeaders ,
5252 } ,
5353 }
5454 ) ;
@@ -134,7 +134,7 @@ export default function AuthCallback() {
134134 />
135135 ) }
136136 < div className = "text-left" >
137- < p className = "text-sm font-medium text-gray-900" > { userInfo . username } </ p >
137+ < p className = "text-sm font-medium text-gray-900" > { userInfo . name } </ p >
138138 < p className = "text-sm text-gray-500" > { userInfo . email } </ p >
139139 </ div >
140140 </ div >
Original file line number Diff line number Diff line change 33import Image from "next/image" ;
44import { useRouter } from "next/navigation" ;
55import { useEffect , useState } from "react" ;
6+ import { authHeaders } from "@/config/header" ;
67import { SIGN_IN_LINK } from "@/config/link" ;
7- import { env } from "@/env" ;
88import { client } from "@/lib/client" ;
99
1010interface UserInfo {
1111 id : string ;
1212 email : string ;
13- username : string ;
13+ name : string ;
1414 avatar_url ?: string ;
1515}
1616
@@ -39,9 +39,7 @@ export default function TestPage() {
3939 . post (
4040 { } ,
4141 {
42- headers : {
43- credentials : "include" ,
44- } ,
42+ ...authHeaders ,
4543 }
4644 )
4745 . catch ( ( error ) => {
@@ -67,7 +65,7 @@ export default function TestPage() {
6765 />
6866 ) }
6967 < div className = "text-left" >
70- < h3 className = "text-lg font-medium text-gray-900" > { user . username } </ h3 >
68+ < h3 className = "text-lg font-medium text-gray-900" > { user . name } </ h3 >
7169 < p className = "text-sm text-gray-500" > { user . email } </ p >
7270 < p className = "text-xs text-gray-400 mt-1" > ID: { user . id } </ p >
7371 </ div >
Original file line number Diff line number Diff line change 1+ export const authHeaders : Record < string , string > = {
2+ credentials : "include" ,
3+ } ;
You can’t perform that action at this time.
0 commit comments