Refine dashboard and RFV visuals
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m18s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m18s
This commit is contained in:
@@ -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[]> => {
|
||||
|
||||
Reference in New Issue
Block a user