log ip parsing
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
export async function parseIp(ip: string) {
|
export async function parseIp(ip: string) {
|
||||||
try {
|
try {
|
||||||
const geo = await fetch(`http://localhost:8080/${ip}`);
|
const geo = await fetch(`${process.env.GEO_IP_HOST}/${ip}`);
|
||||||
const res = (await geo.json()) as {
|
const res = (await geo.json()) as {
|
||||||
country: string | undefined;
|
country: string | undefined;
|
||||||
city: string | undefined;
|
city: string | undefined;
|
||||||
@@ -15,6 +15,8 @@ export async function parseIp(ip: string) {
|
|||||||
continent: res.continent,
|
continent: res.continent,
|
||||||
};
|
};
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
console.log('Failed to parse ip', e);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
country: undefined,
|
country: undefined,
|
||||||
city: undefined,
|
city: undefined,
|
||||||
|
|||||||
Reference in New Issue
Block a user