Improve data fetching and handling for sales information on the platform

Updates `useQuery` hooks to explicitly parse JSON responses for sales data.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 91318273-c764-4fd4-be04-bdc12c38af32
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/0715008c-7244-40f4-befc-26c014852236/ab880d72-1a34-4d36-b5be-9f44df85ed1a.jpg
This commit is contained in:
michaelschal committed 2025-07-09 18:51:55 +00:00
1 parent b1835987f9
commit 462ebeb816
3 files changed
+11 -6

No files matched your search

+5 -3
View File
@@ -57,11 +57,13 @@ export default function NewSaleForm() {
const availableCategories = typeArticle ? ARTICLE_CATEGORY_MAPPING[typeArticle as keyof typeof ARTICLE_CATEGORY_MAPPING] || [] : [];
const createSaleMutation = useMutation({
mutationFn: (saleData: any) =>
apiRequest('/api/sales', {
mutationFn: async (saleData: any) => {
const response = await apiRequest('/api/sales', {
method: 'POST',
body: JSON.stringify(saleData),
}),
});
return response.json();
},
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['/api/sales'] });
toast({