This commit is contained in:
NotII
2025-04-07 19:25:24 +01:00
parent 7f7dd78818
commit 2f48ee38c2
102 changed files with 1825 additions and 761 deletions

View File

@@ -0,0 +1,47 @@
import { clientFetch } from '../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');
};