From 61f26b0386bb78ad7d00a4ccfc9101958ad23d7e Mon Sep 17 00:00:00 2001 From: ykdojo Date: Tue, 22 Dec 2020 18:09:31 -0800 Subject: [PATCH] Minor fixes in _app.js (Slack clone) --- examples/nextjs-slack-clone/pages/_app.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/nextjs-slack-clone/pages/_app.js b/examples/nextjs-slack-clone/pages/_app.js index 0a9d6927724..ecae6586e12 100644 --- a/examples/nextjs-slack-clone/pages/_app.js +++ b/examples/nextjs-slack-clone/pages/_app.js @@ -38,12 +38,12 @@ export default function SupabaseSlackClone({Component, pageProps}){ }, [user]) const signIn = async (id, username) => { - let { body } = await supabase.from('users').select('id, username').eq('id', id) + const { body } = await supabase.from('users').select('id, username').eq('id', id) const result = body[0] // If the user exists in the users table, update the username. // If not, create a new row. - let { body2 } = result?.id + result?.id ? await supabase.from('users').update({ id, username }).match({ id }).single() : await supabase.from('users').insert([{ id, username }]).single() }