Skip to content

Commit

Permalink
add user check in auth-with-stytch. (#38648)
Browse files Browse the repository at this point in the history
* add user check in `auth-with-stytch`.

* Revert "delete auto.js in pollyfills"

* lint-fix

Co-authored-by: JJ Kasper <jj@jjsweb.site>
  • Loading branch information
eminvergil and ijjk committed Jul 15, 2022
1 parent 48401ec commit 0e6c63f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions examples/auth-with-stytch/pages/index.tsx
Expand Up @@ -48,13 +48,17 @@ const stytchProps: StytchProps = {
},
publicToken: process.env.NEXT_PUBLIC_STYTCH_PUBLIC_TOKEN || '',
callbacks: {
onEvent: (data) => {
// TODO: check whether the user exists in your DB
if (data.eventData.type === 'USER_EVENT_TYPE') {
onEvent: (data: { eventData: { userId: any; email: any } }) => {
if (
data.eventData.userId !== undefined &&
data.eventData.userId != null
) {
console.log({
userId: data.eventData.userId,
email: data.eventData.email,
})
} else {
console.warn('The user is not found. Data: ', data)
}
},
onSuccess: (data) => console.log(data),
Expand Down

0 comments on commit 0e6c63f

Please sign in to comment.