Разработка админ-панели EventHubFrontAdmin v1.0 #1
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { dashboardApi } from '../api/dashboardApi';
|
||||
import { normalizeData } from '../utils/normalize';
|
||||
|
||||
export const useDashboardStats = (from?: string, to?: string) => {
|
||||
return useQuery({
|
||||
queryKey: ['dashboard', from, to],
|
||||
queryFn: async () => {
|
||||
const data = await dashboardApi.getStats(from, to);
|
||||
return normalizeData(data);
|
||||
},
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user