Skip to content

A full-featured CRM built with React, shadcn/ui, and Supabase.

Only get error details when there is an error.

Matthieu Hochlandere925b78fb246
diff --git a/src/components/atomic-crm/providers/supabase/dataProvider.ts b/src/components/atomic-crm/providers/supabase/dataProvider.ts
index 300726ea..06733a19 100644
--- a/src/components/atomic-crm/providers/supabase/dataProvider.ts
+++ b/src/components/atomic-crm/providers/supabase/dataProvider.ts
@@ -133,10 +133,10 @@ const dataProviderWithCustomMethods = {
method: "POST",
body,
});
- const errorDetails = await error.context.json();
if (!data || error) {
console.error("salesCreate.error", error);
+ const errorDetails = await error.context.json();
throw new Error(errorDetails.message || "Failed to create the user");
}