11import { useEffect , useState } from 'react' ;
22import Head from 'next/head' ;
33import Image from 'next/image' ;
4- import { useRouter } from 'next/router' ;
54
65import styles from '../styles/Home.module.css' ;
7- import linkedin from '../../.. /assets/linkedin.png' ;
8- import { useLinkedIn } from '../../../build/index.esm ' ;
6+ import linkedin from 'react-linkedin-login-oauth2 /assets/linkedin.png' ;
7+ import { useLinkedIn } from 'react-linkedin-login-oauth2 ' ;
98
109export default function Home ( ) {
1110 const [ code , setCode ] = useState ( '' ) ;
@@ -21,7 +20,7 @@ export default function Home() {
2120 setCode ( code ) ;
2221 } ,
2322 scope : 'r_emailaddress' ,
24- onFailure : ( error ) => {
23+ onError : ( error ) => {
2524 console . log ( error ) ;
2625 setErrorMessage ( error . errorMessage ) ;
2726 } ,
@@ -43,19 +42,13 @@ export default function Home() {
4342 < p className = { styles . description } >
4443 Get started by editing{ ' ' }
4544 < code className = { styles . code } > pages/index.js</ code >
46- < button
47- onClick = { ( e ) => {
48- e . preventDefault ( ) ;
49- linkedInLogin ( ) ;
50- } }
51- >
52- < Image
53- src = { linkedin }
54- alt = "Log in with Linked In"
55- width = { 180 }
56- height = { 32 }
57- />
58- </ button >
45+ < Image
46+ src = { linkedin }
47+ alt = "Log in with Linked In"
48+ width = { 180 }
49+ height = { 32 }
50+ onClick = { linkedInLogin }
51+ />
5952 { ! code && < div > No code</ div > }
6053 { code && < div > Code: { code } </ div > }
6154 { errorMessage && < div > { errorMessage } </ div > }
0 commit comments