From 70ae78d4765e1fd6c1cc40f439631614fb0885f8 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Fri, 6 Oct 2023 15:16:17 -0700 Subject: handle pin deletion differently --- lib/locations.js | 5 ++++- routes/locations.js | 3 ++- routes/users.js | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/locations.js b/lib/locations.js index 39883555..29ff4c07 100644 --- a/lib/locations.js +++ b/lib/locations.js @@ -8,7 +8,10 @@ export let getLocations = async () => { ).json(); locations = locations.filter( - l => l["osm_json"].tags && l["osm_json"].tags["payment:coinos"] === "yes" + l => + l["osm_json"].tags && + l["osm_json"].tags["payment:coinos"] === "yes" && + l["osm_json"]["type"] === "node" ); await s("locations", locations); diff --git a/routes/locations.js b/routes/locations.js index fb4487f7..0f71fde9 100644 --- a/routes/locations.js +++ b/routes/locations.js @@ -2,6 +2,7 @@ import { g } from "$lib/db"; export default { async list(req, res) { - res.send({ locations: await g("locations") }); + let locations = await g("locations"); + res.send({ locations }); } }; diff --git a/routes/users.js b/routes/users.js index 158a61b1..2867e53a 100644 --- a/routes/users.js +++ b/routes/users.js @@ -187,7 +187,7 @@ export default { if (user.pin && !(pin === user.pin)) throw new Error("Pin required"); if (typeof newpin !== "undefined" && newpin.length === 6) user.pin = newpin; - if (!user.pin || user.pin === "undefined") delete user.pin; + if (user.pin === "delete") delete user.pin; let exists; if (username) exists = await getUser(username); -- cgit v1.2.3