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 | 4x 4x 4x 33x 33x 21x 33x | import { badgesKey } from "features/queryKeys"; import { Badge } from "proto/resources_pb"; import { useQuery } from "react-query"; import { service } from "service"; export const useBadges = () => { const { data, ...rest } = useQuery(badgesKey, () => service.resources.getBadges().then((result) => result.badgesList.reduce( (badgesResult, badge) => { badgesResult.badges[badge.id] = badge; return badgesResult; }, { badges: {} as { [id: string]: Badge.AsObject }, } ) ) ); return { badges: data?.badges, ...rest, }; }; |