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 | 4x 4x 4x 199x 199x 18x 18x 162x 162x 162x 199x | import { regionsKey } from "features/queryKeys"; import { useQuery } from "react-query"; import { service } from "service"; export const useRegions = () => { const { data, ...rest } = useQuery(regionsKey, () => service.resources.getRegions().then((result) => result.regionsList.reduce( (regionsResult, { alpha3, name }) => { regionsResult.regions[alpha3] = name; regionsResult.regionsLookup[name] = alpha3; return regionsResult; }, { regions: {} as { [code: string]: string }, regionsLookup: {} as { [name: string]: string }, } ) ) ); return { regions: data?.regions, regionsLookup: data?.regionsLookup, ...rest, }; }; |