Refine dashboard and RFV visuals
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m18s

This commit is contained in:
Cauê Faleiros
2026-06-25 10:38:31 -03:00
parent a6858fe2fc
commit eb77dd3ba2
6 changed files with 489 additions and 236 deletions

View File

@@ -165,14 +165,20 @@ export const fetchDashboardAnalytics = async (dateRange: DateRange, options?: Ca
const path = `/analytics/dashboard?${buildDateRangeParams(dateRange).toString()}`;
return getCachedAnalytics(path, async () => {
try {
const response = await authFetch(path);
const response = await authFetch(path, options?.force ? { cache: 'no-store' } : {});
if (!response.ok) return null;
return await response.json();
} catch (error) {
console.error('Fetch dashboard analytics failed', error);
return null;
}
}, options);
}, {
...options,
shouldCache: (data) => {
const metrics = data as DashboardAnalytics | null;
return Boolean(metrics && Array.isArray(metrics.revenueBySeller) && Array.isArray(metrics.ordersBySeller));
}
});
};
export const fetchProductAnalytics = async (dateRange: DateRange): Promise<ProductAnalyticsItem[]> => {