log ip parsing

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-02-05 23:04:43 +01:00
parent 1fe3164350
commit b2e8398943

View File

@@ -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,