Skip to content

Commit 28c3247

Browse files
committed
chore: Update nextjs examples
1 parent afa0a96 commit 28c3247

File tree

2 files changed

+11
-18
lines changed

2 files changed

+11
-18
lines changed

examples/nextjs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"next": "12.0.1",
1313
"react": "17.0.2",
1414
"react-dom": "17.0.2",
15-
"react-linkedin-login-oauth2": "^2.0.0-alpha.0"
15+
"react-linkedin-login-oauth2": "^2.0.0-alpha.1"
1616
},
1717
"devDependencies": {
1818
"eslint": "7.32.0",

examples/nextjs/pages/index.js

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import { useEffect, useState } from 'react';
22
import Head from 'next/head';
33
import Image from 'next/image';
4-
import { useRouter } from 'next/router';
54

65
import 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

109
export 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

Comments
 (0)