|
|
|
@ -4,6 +4,7 @@ import { |
|
|
|
useMemo, |
|
|
|
useMemo, |
|
|
|
} from 'react' |
|
|
|
} from 'react' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import orderBy from 'lodash/orderBy' |
|
|
|
import map from 'lodash/map' |
|
|
|
import map from 'lodash/map' |
|
|
|
|
|
|
|
|
|
|
|
import type { Countries } from 'requests' |
|
|
|
import type { Countries } from 'requests' |
|
|
|
@ -33,10 +34,13 @@ export const useCountries = () => { |
|
|
|
const nameField = `name_${lang}` as 'name_eng' |
|
|
|
const nameField = `name_${lang}` as 'name_eng' |
|
|
|
|
|
|
|
|
|
|
|
const transformedCountries = useMemo( |
|
|
|
const transformedCountries = useMemo( |
|
|
|
() => map(countries, (country) => ({ |
|
|
|
() => orderBy( |
|
|
|
id: country.id, |
|
|
|
map(countries, (country) => ({ |
|
|
|
name: country[nameField], |
|
|
|
id: country.id, |
|
|
|
})), |
|
|
|
name: country[nameField], |
|
|
|
|
|
|
|
})), |
|
|
|
|
|
|
|
'name', |
|
|
|
|
|
|
|
), |
|
|
|
[countries, nameField], |
|
|
|
[countries, nameField], |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|