Minor fixes in _app.js (Slack clone)

This commit is contained in:
ykdojo committed 2020-12-22 18:09:31 -08:00
1 parent 6b8e794fa2
commit 61f26b0386
1 file changed
+2 -2
+2 -2
View File
@@ -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()
}