Some checks failed
Build Frontend / build (push) Failing after 7s
Replaces imports from 'components/ui' with 'components/common' across the app and dashboard pages, and updates model and API imports to use new paths under 'lib'. Removes redundant authentication checks from several dashboard pages. Adds new dashboard components and utility files, and reorganizes hooks and services into the 'lib' directory for improved structure.
47 lines
901 B
TypeScript
47 lines
901 B
TypeScript
import { clientFetch } from '@/lib/api/api-client';
|
|
|
|
// Stats data types
|
|
export interface PlatformStats {
|
|
orders: {
|
|
completed: number;
|
|
};
|
|
vendors: {
|
|
total: number;
|
|
};
|
|
transactions: {
|
|
volume: number;
|
|
averageOrderValue: number;
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Get platform statistics
|
|
*/
|
|
export const getPlatformStats = async (): Promise<PlatformStats> => {
|
|
try {
|
|
return await clientFetch('/stats/platform');
|
|
} catch (error) {
|
|
console.error('Error fetching platform stats:', error);
|
|
|
|
// Return fallback data if API fails
|
|
return {
|
|
orders: {
|
|
completed: 15800
|
|
},
|
|
vendors: {
|
|
total: 2400
|
|
},
|
|
transactions: {
|
|
volume: 3200000,
|
|
averageOrderValue: 220
|
|
}
|
|
};
|
|
}
|
|
};
|
|
|
|
/**
|
|
* Get vendor-specific statistics
|
|
*/
|
|
export const getVendorStats = async (): Promise<any> => {
|
|
return clientFetch('/stats/vendor');
|
|
};
|