// API client for your dashboard backend
async function getDashboardData(client) {
const endpoints = [
{ key: 'overview', path: '/metrics/overview' },
{ key: 'pipeline', path: '/metrics/pipeline' },
{ key: 'conversion', path: '/metrics/conversion' },
{ key: 'dailySales', path: '/metrics/sales?period=daily' },
{ key: 'weeklySales', path: '/metrics/sales?period=weekly' },
{ key: 'teamPerformance', path: '/metrics/team-performance' },
{ key: 'timing', path: '/metrics/proposal-timing' },
{ key: 'rejections', path: '/metrics/rejection-reasons' },
];
const results = await Promise.all(
endpoints.map(async ({ key, path }) => {
const response = await client.request(path);
const { data } = await response.json();
return [key, data];
})
);
return Object.fromEntries(results);
}