feat: reworked ttn webhook endpoint logic

This commit is contained in:
2025-01-03 02:01:55 +01:00
parent ffdb644700
commit 62847f569d
17 changed files with 273 additions and 356 deletions

View File

@ -47,6 +47,7 @@ export const getLocationForWifi = async (
try {
const url = `${process.env.WIGLE_BASE_URL!}${process.env
.WIGLE_NETWORK_SEARCH!}?netid=${encodeURIComponent(mac)}`;
const response = await fetch(url, {
method: "GET",
headers: {
@ -54,12 +55,12 @@ export const getLocationForWifi = async (
Authorization: `Basic ${process.env.WIGLE_TOKEN}`,
},
});
if (response.ok) {
return await response.json();
}
console.log(response.status);
return undefined;
} catch (error) {
console.error("Error during call of API wigle.net:", error);
}