From efd3ff8ae4b2eb3bfeabcd11bc5340d4688df54d Mon Sep 17 00:00:00 2001 From: eminvergil Date: Thu, 14 Jul 2022 19:05:04 +0300 Subject: [PATCH 1/3] add user check in `auth-with-stytch`. --- examples/auth-with-stytch/pages/index.tsx | 9 +++++---- packages/next/build/polyfills/object.assign/auto.js | 1 - 2 files changed, 5 insertions(+), 5 deletions(-) delete mode 100644 packages/next/build/polyfills/object.assign/auto.js diff --git a/examples/auth-with-stytch/pages/index.tsx b/examples/auth-with-stytch/pages/index.tsx index 588e6c806c86..35a0a66fe3cc 100644 --- a/examples/auth-with-stytch/pages/index.tsx +++ b/examples/auth-with-stytch/pages/index.tsx @@ -48,14 +48,15 @@ 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), onError: (data) => console.log(data), diff --git a/packages/next/build/polyfills/object.assign/auto.js b/packages/next/build/polyfills/object.assign/auto.js deleted file mode 100644 index 172f1ae6a468..000000000000 --- a/packages/next/build/polyfills/object.assign/auto.js +++ /dev/null @@ -1 +0,0 @@ -// noop From 766f16314fafe00c28285526a3e9b1602444a70d Mon Sep 17 00:00:00 2001 From: eminvergil Date: Fri, 15 Jul 2022 12:12:05 +0300 Subject: [PATCH 2/3] Revert "delete auto.js in pollyfills" --- examples/auth-with-stytch/pages/index.tsx | 2 +- packages/next/build/polyfills/object.assign/auto.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 packages/next/build/polyfills/object.assign/auto.js diff --git a/examples/auth-with-stytch/pages/index.tsx b/examples/auth-with-stytch/pages/index.tsx index 35a0a66fe3cc..3a2c837ef6bd 100644 --- a/examples/auth-with-stytch/pages/index.tsx +++ b/examples/auth-with-stytch/pages/index.tsx @@ -56,7 +56,7 @@ const stytchProps: StytchProps = { }) } else { console.warn("The user is not found. Data: ", data); - } + } }, onSuccess: (data) => console.log(data), onError: (data) => console.log(data), diff --git a/packages/next/build/polyfills/object.assign/auto.js b/packages/next/build/polyfills/object.assign/auto.js new file mode 100644 index 000000000000..172f1ae6a468 --- /dev/null +++ b/packages/next/build/polyfills/object.assign/auto.js @@ -0,0 +1 @@ +// noop From 2e905ab6336c18d74abc2ff45df0c1f99e89171e Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Fri, 15 Jul 2022 11:41:03 -0500 Subject: [PATCH 3/3] lint-fix --- examples/auth-with-stytch/pages/index.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/examples/auth-with-stytch/pages/index.tsx b/examples/auth-with-stytch/pages/index.tsx index 3a2c837ef6bd..3974f66563b7 100644 --- a/examples/auth-with-stytch/pages/index.tsx +++ b/examples/auth-with-stytch/pages/index.tsx @@ -49,13 +49,16 @@ const stytchProps: StytchProps = { publicToken: process.env.NEXT_PUBLIC_STYTCH_PUBLIC_TOKEN || '', callbacks: { onEvent: (data: { eventData: { userId: any; email: any } }) => { - if (data.eventData.userId != undefined && data.eventData.userId != null) { + 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); + console.warn('The user is not found. Data: ', data) } }, onSuccess: (data) => console.log(data),