fix formatvalue for city showing undefined

This commit is contained in:
Francis Cao 2023-12-19 19:03:53 -08:00
parent cdc2624caf
commit 8f2fac10d1
2 changed files with 3 additions and 3 deletions

View file

@ -2,7 +2,7 @@ import useMessages from './useMessages';
import { BROWSERS } from 'lib/constants';
import useLocale from './useLocale';
import useCountryNames from './useCountryNames';
import regions from 'public/iso-3166-2.json';
import regions from '../../../public/iso-3166-2.json';
export function useFormat() {
const { formatMessage, labels } = useMessages();
@ -23,7 +23,7 @@ export function useFormat() {
};
const formatCity = (value: string, country?: string): string => {
return `${value}, ${countryNames[country]}`;
return countryNames[country] ? `${value}, ${countryNames[country]}` : value;
};
const formatDevice = (value: string): string => {