import { useQuery } from "@tanstack/react-query"; import { fetchCounts, fetchLibraries, fetchNowPlaying } from "../api/client"; export function useCounts() { return useQuery({ queryKey: ["dashboard", "counts"], queryFn: fetchCounts, staleTime: 5 * 60 * 1000, }); } export function useLibraries() { return useQuery({ queryKey: ["dashboard", "libraries"], queryFn: fetchLibraries, staleTime: 5 * 60 * 1000, }); } export function useNowPlaying() { return useQuery({ queryKey: ["dashboard", "now-playing"], queryFn: fetchNowPlaying, refetchInterval: 15_000, }); }