erro
This commit is contained in:
@@ -572,14 +572,12 @@ export const AppProvider = ({ children }: { children: React.ReactNode }) => {
|
||||
// O backend usa image_url, não imageUrl. Se existir novo no payload usa, senão fallback para o atual.
|
||||
const resolvedImageUrl = imageUrl ?? currentShop?.imageUrl;
|
||||
|
||||
const { error } = await supabase.from('shops').upsert({
|
||||
id: shopId,
|
||||
name: currentShop?.name || 'Barbearia',
|
||||
address: currentShop?.address || '',
|
||||
rating: currentShop?.rating ?? 0,
|
||||
image_url: resolvedImageUrl,
|
||||
...dbPayload,
|
||||
}, { onConflict: 'id' });
|
||||
const updateData: Record<string, any> = { ...dbPayload };
|
||||
if (resolvedImageUrl !== undefined) updateData.image_url = resolvedImageUrl;
|
||||
if (!updateData.name) updateData.name = currentShop?.name || 'Barbearia';
|
||||
if (!updateData.address && dbPayload.address !== undefined) updateData.address = dbPayload.address;
|
||||
|
||||
const { error } = await supabase.from('shops').update(updateData).eq('id', shopId);
|
||||
|
||||
if (error) {
|
||||
console.error('ERRO SUPABASE updateShopDetails:', error);
|
||||
|
||||
Reference in New Issue
Block a user