diff --git a/examples/auth-with-stytch/pages/index.tsx b/examples/auth-with-stytch/pages/index.tsx index 588e6c806c86..3974f66563b7 100644 --- a/examples/auth-with-stytch/pages/index.tsx +++ b/examples/auth-with-stytch/pages/index.tsx @@ -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),