Fix location lookup.

This commit is contained in:
Mike Cao 2023-04-02 22:36:52 -07:00
parent 7464bd2521
commit ba71f5cafc

View File

@ -71,8 +71,8 @@ export async function getLocation(ip) {
const result = lookup.get(ip);
const country = result?.country?.iso_code ?? result?.registered_country?.iso_code;
const subdivision1 = result?.subdivisions[0]?.iso_code;
const subdivision2 = result?.subdivisions[1]?.names?.en;
const subdivision1 = result?.subdivisions?.[0]?.iso_code;
const subdivision2 = result?.subdivisions?.[1]?.names?.en;
const city = result?.city?.names?.en;
return { country, subdivision1, subdivision2, city };