Skip to content

Commit

Permalink
chore: apply prettier, fix linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ilfa committed Apr 14, 2022
1 parent c618844 commit 1397498
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 25 deletions.
16 changes: 10 additions & 6 deletions examples/next/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@ import '../styles/globals.css'
import type { AppProps } from 'next/app'
import { FpjsProvider } from '@fingerprintjs/fingerprintjs-pro-react'

const fpjsPublicApiKey = process.env.NEXT_PUBLIC_FPJS_PUBLIC_API_KEY as string;
const fpjsPublicApiKey = process.env.NEXT_PUBLIC_FPJS_PUBLIC_API_KEY as string

function MyApp({ Component, pageProps }: AppProps) {
return <FpjsProvider
loadOptions={{
apiKey: fpjsPublicApiKey
}}><Component {...pageProps} />
</FpjsProvider>
return (
<FpjsProvider
loadOptions={{
apiKey: fpjsPublicApiKey,
}}
>
<Component {...pageProps} />
</FpjsProvider>
)
}

export default MyApp
35 changes: 17 additions & 18 deletions examples/next/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
import type { NextPage } from 'next'
import Head from 'next/head'
import styles from '../styles/Home.module.css'
import { useVisitorData } from "@fingerprintjs/fingerprintjs-pro-react"
import { useState } from "react"
import { useVisitorData } from '@fingerprintjs/fingerprintjs-pro-react'
import { useState } from 'react'

const Home: NextPage = () => {
const [extendedResult, updateExtendedResult] = useState(false);
const {
isLoading,
error,
data,
getData,
} = useVisitorData({extendedResult}, {immediate: true});
const [extendedResult, updateExtendedResult] = useState(false)
const { isLoading, error, data, getData } = useVisitorData({ extendedResult }, { immediate: true })

const reloadData = () => {
getData({ignoreCache: true});
getData({ ignoreCache: true })
}

const onChangeExtendedResult = (e: React.ChangeEvent<HTMLInputElement>) => {
Expand All @@ -25,29 +20,33 @@ const Home: NextPage = () => {
<div className={styles.container}>
<Head>
<title>FingerprintJS Pro NextJS Demo</title>
<meta name="description" content="Check if fingerprintjs-pro-react integration works with NextJS SSR" />
<link rel="icon" href="/favicon.ico" />
<meta name='description' content='Check if fingerprintjs-pro-react integration works with NextJS SSR' />
<link rel='icon' href='/favicon.ico' />
</Head>

<h1>FingerprintJS Pro NextJS Demo</h1>
<div className={styles.testArea}>
<div className={styles.description}>Lets load FingerprintJS Pro Agent using react integration and check next things:</div>
<div className={styles.description}>
Lets load FingerprintJS Pro Agent using react integration and check next things:
</div>
<ol className={styles.actionPoints}>
<li>There is no errors on server</li>
<li>There is no errors on client</li>
<li>In the field below visitor data was loaded</li>
<li>Try controls to test additional params</li>
</ol>
<div className={styles.controls}>
<button onClick={reloadData} type="button">Reload data</button>
<button onClick={reloadData} type='button'>
Reload data
</button>
<label>
<input type="checkbox" onChange={onChangeExtendedResult} checked={extendedResult}/>
<input type='checkbox' onChange={onChangeExtendedResult} checked={extendedResult} />
Extended result
</label>
</div>
<h4>VisitorId: <span className={styles.visitorId}>
{isLoading ? 'Loading...' : data?.visitorId}
</span></h4>
<h4>
VisitorId: <span className={styles.visitorId}>{isLoading ? 'Loading...' : data?.visitorId}</span>
</h4>
<h4>Full visitor data:</h4>
<pre className={styles.data}>{error ? error.message : JSON.stringify(data, null, 2)}</pre>
</div>
Expand Down
4 changes: 3 additions & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const commonOutput = {
sourcemap: true,
}

export default [
const RollupConfig = [
// NPM bundles. They have all the dependencies excluded for end code size optimization.
{
...commonInput,
Expand Down Expand Up @@ -59,3 +59,5 @@ export default [
},
},
]

export default RollupConfig

0 comments on commit 1397498

Please sign in to comment.