import { useHallStore } from "@/Stores"; import { formatText } from "@/Utility"; import { wwwAXIOS } from "@/Www"; import { GetHallAPI } from "@/wwwAPI"; import { useQuery } from "@tanstack/react-query"; import { useIsPath } from "taehui-ts/fe-utility"; export default function useGetAbility5KHall() { const { tabPosition, abilityTabPosition } = useHallStore(); const isPath = useIsPath(); return useQuery< { avatarID: string; avatarName: string; text: string; }[] >({ enabled: tabPosition === 2 && abilityTabPosition === 0 && isPath("/hall"), queryKey: ["ability5KHall"], queryFn: async () => { const { data } = await wwwAXIOS.get<GetHallAPI[]>("/hall/ability/5K"); return data.map((hall) => ({ ...hall, text: `${formatText(hall.value)} Point`, })); }, initialData: [], }); }