import { useHOFStore } from "@/Stores"; import { formatText } from "@/Utility"; import { wwwAXIOS } from "@/Www"; import { GetHOFAPI } from "@/wwwAPI"; import { useQuery } from "@tanstack/react-query"; import { useIsPath } from "taehui-ts/fe-utility"; export default function useGetLevelHOF() { const { tabPosition } = useHOFStore(); const isPath = useIsPath(); return useQuery< { avatarID: string; avatarName: string; text: string; }[] >({ enabled: tabPosition === 3 && isPath("/hof"), queryKey: ["levelHOF"], queryFn: async () => { const { data } = await wwwAXIOS.get<GetHOFAPI[]>("/hof/level"); return data.map((hof) => ({ ...hof, text: `LV.${formatText(hof.value)}`, })); }, initialData: [], }); }