register
This commit is contained in:
@@ -33,6 +33,13 @@ export default function AuthRegister() {
|
||||
const { data, error: signUpError } = await supabase.auth.signUp({
|
||||
email,
|
||||
password,
|
||||
options: {
|
||||
data: {
|
||||
name,
|
||||
role,
|
||||
shop_name: role === 'barbearia' ? shopName : null,
|
||||
},
|
||||
},
|
||||
})
|
||||
if (signUpError) throw signUpError
|
||||
|
||||
@@ -44,12 +51,17 @@ export default function AuthRegister() {
|
||||
}
|
||||
|
||||
// 2) Criar perfil na tabela public.profiles
|
||||
const { error: profileError } = await supabase.from('profiles').insert({
|
||||
id: userId,
|
||||
name,
|
||||
role,
|
||||
shop_name: role === 'barbearia' ? shopName : null,
|
||||
})
|
||||
const { error: profileError } = await supabase
|
||||
.from('profiles')
|
||||
.upsert(
|
||||
{
|
||||
id: userId,
|
||||
name,
|
||||
role,
|
||||
shop_name: role === 'barbearia' ? shopName : null,
|
||||
},
|
||||
{ onConflict: 'id' }
|
||||
)
|
||||
if (profileError) throw profileError
|
||||
|
||||
// 3) Redirecionar
|
||||
|
||||
Reference in New Issue
Block a user