Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 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 37 38 39 40 | 22x 11x 9x 3x 1x 1x 3x 1x 1x | import { useQuery } from "@tanstack/react-query";
import { proApi } from "../../lib/api";
import { queryKeys } from "../../lib/query-keys";
export function useProMe(enabled = true) {
return useQuery({
queryKey: queryKeys.pro.me(),
queryFn: async () => {
const response = await proApi.getMyPro();
return response.data;
},
enabled,
});
}
export function useProProfile(proId: string | null) {
return useQuery({
queryKey: queryKeys.pro.profile(proId ?? ""),
queryFn: async () => {
const response = await proApi.getProfile(proId as string);
return response.data;
},
enabled: !!proId,
});
}
export function useProStats(proId: string | null) {
return useQuery({
queryKey: queryKeys.pro.stats(proId ?? ""),
queryFn: async () => {
const response = await proApi.getProStats(
proId as string,
);
return response.data;
},
enabled: !!proId,
staleTime: 1000 * 60 * 2, // 2 minutes - stats change less frequently
});
}
|