correção de erro

This commit is contained in:
2026-03-12 10:22:29 +00:00
parent e9b022a4d3
commit 9b8a4e02b9

View File

@@ -493,8 +493,10 @@ export const AppProvider = ({ children }: { children: React.ReactNode }) => {
const { error } = await supabase.from('services').insert([
{ shop_id: shopId, name: service.name, price: service.price, duration: service.duration }
]);
if (error) console.error("Erro addService:", error);
else await refreshShops();
if (error) {
console.error("Erro addService:", error);
alert(`Erro ao guardar serviço: ${error.message}`);
} else await refreshShops();
};
const updateService: AppContextValue['updateService'] = async (shopId, service) => {
@@ -515,8 +517,10 @@ export const AppProvider = ({ children }: { children: React.ReactNode }) => {
const { error } = await supabase.from('products').insert([
{ shop_id: shopId, name: product.name, price: product.price, stock: product.stock }
]);
if (error) console.error("Erro addProduct:", error);
else await refreshShops();
if (error) {
console.error("Erro addProduct:", error);
alert(`Erro ao guardar produto: ${error.message}`);
} else await refreshShops();
};
const updateProduct: AppContextValue['updateProduct'] = async (shopId, product) => {
@@ -537,8 +541,10 @@ export const AppProvider = ({ children }: { children: React.ReactNode }) => {
const { error } = await supabase.from('barbers').insert([
{ shop_id: shopId, name: barber.name, specialties: barber.specialties }
]);
if (error) console.error("Erro addBarber:", error);
else await refreshShops();
if (error) {
console.error("Erro addBarber:", error);
alert(`Erro ao guardar barbeiro: ${error.message}`);
} else await refreshShops();
};
const updateBarber: AppContextValue['updateBarber'] = async (shopId, barber) => {