Files
no-copy-admin-panel-frontend/src/app/lib/prefetch-queries.ts
T

45 lines
1.6 KiB
TypeScript
Raw Normal View History

2026-01-19 16:34:29 +07:00
import { QueryClient } from '@tanstack/react-query';
2026-05-15 15:31:40 +07:00
import { fetchTokensGeneralStatistic, fetchProtectedContentGeneralStatistic, fetchTariffStatistic, fetchUserFilesTopStatistic, fetchUserGeneralStatistic, fetchViolationGeneralStatistic } from '@/app/actions/statisticActions';
import { useSubscribeGeneralStatistic } from '@/app/hooks/react-query/dashboard/useSubscribeGeneralStatistic';
2026-05-20 16:23:19 +07:00
import { fetchEmployeInfo } from '@/app/actions/stuffActions';
2026-01-19 16:34:29 +07:00
export async function prefetchLayoutQueries(queryClient: QueryClient) {
await Promise.all([
2026-05-20 16:23:19 +07:00
queryClient.prefetchQuery({
queryKey: ['fetchEmployeInfo'],
queryFn: () => fetchEmployeInfo()
}),
2026-01-19 16:34:29 +07:00
queryClient.prefetchQuery({
2026-05-15 15:31:40 +07:00
queryKey: ['incomeGeneralStatistic'],
queryFn: () => fetchTokensGeneralStatistic()
}),
queryClient.prefetchQuery({
queryKey: ['protectedContentGeneralStatistic'],
queryFn: () => fetchProtectedContentGeneralStatistic()
}),
queryClient.prefetchQuery({
queryKey: ['subscribeGeneralStatistic'],
queryFn: () => useSubscribeGeneralStatistic()
}),
queryClient.prefetchQuery({
queryKey: ['tariffStatistic'],
queryFn: () => fetchTariffStatistic()
}),
queryClient.prefetchQuery({
queryKey: ['tokensGeneralStatistic'],
queryFn: () => fetchTokensGeneralStatistic()
}),
queryClient.prefetchQuery({
queryKey: ['userFilesTopStatistic'],
queryFn: () => fetchUserFilesTopStatistic()
}),
queryClient.prefetchQuery({
queryKey: ['userGeneralStatistic'],
queryFn: () => fetchUserGeneralStatistic()
}),
queryClient.prefetchQuery({
queryKey: ['violationGeneralStatistic'],
queryFn: () => fetchViolationGeneralStatistic()
}),
2026-01-19 16:34:29 +07:00
]);
}