fix: Handle duplicate shop errors during synchronization and refresh the shop list.
This commit is contained in:
@@ -184,7 +184,14 @@ export const AppProvider = ({ children }: { children: React.ReactNode }) => {
|
||||
rating: 0
|
||||
}
|
||||
]).then(({ error }) => {
|
||||
if (error) console.error("Erro ao sincronizar shop nova na BD:", error);
|
||||
if (error) {
|
||||
// Ignora o erro de duplicado (shop já existe na BD)
|
||||
if (error.code !== '23505') {
|
||||
console.error("Erro ao sincronizar shop nova na BD:", error);
|
||||
}
|
||||
}
|
||||
// Recarrega shops da BD para garantir que a nova shop aparece corretamente
|
||||
void refreshShops();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,6 +91,9 @@ export default function Dashboard() {
|
||||
} = useApp();
|
||||
const shop = shops.find((s) => s.id === user?.shopId);
|
||||
|
||||
|
||||
|
||||
|
||||
const [activeTab, setActiveTab] = useState<TabId>('overview');
|
||||
const [period, setPeriod] = useState<keyof typeof periods>('semana');
|
||||
const [appointmentView, setAppointmentView] = useState<'list' | 'calendar'>('list');
|
||||
|
||||
Reference in New Issue
Block a user