File size: 1,066 Bytes
b87cbc7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | import { useQuery } from "@tanstack/react-query";
import { trpc } from "@/utils/trpc";
export function useAnalytics() {
const overview = useQuery(trpc.stats.overview.queryOptions());
const byExamType = useQuery(trpc.stats.byExamType.queryOptions());
const bySectionType = useQuery(trpc.stats.bySectionType.queryOptions());
const byFormat = useQuery(trpc.stats.byFormat.queryOptions());
const bySkillTag = useQuery(trpc.stats.bySkillTag.queryOptions());
const trend = useQuery(trpc.stats.trend.queryOptions());
const weaknesses = useQuery(trpc.stats.weaknesses.queryOptions());
const timeAnalytics = useQuery(trpc.stats.timeAnalytics.queryOptions());
const isLoading =
overview.isLoading ||
byExamType.isLoading ||
bySectionType.isLoading ||
byFormat.isLoading ||
bySkillTag.isLoading ||
trend.isLoading ||
weaknesses.isLoading ||
timeAnalytics.isLoading;
return {
overview,
byExamType,
bySectionType,
byFormat,
bySkillTag,
trend,
weaknesses,
timeAnalytics,
isLoading,
};
}
|