From 35a5fa9e126c591959466a68f262f7f8c4e5bdb8 Mon Sep 17 00:00:00 2001 From: Wisse Date: Sun, 6 Aug 2023 15:07:17 +0200 Subject: [PATCH] Update amount of items returned --- pages/api/trains/nearby.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pages/api/trains/nearby.ts b/pages/api/trains/nearby.ts index d7682b1..e64d621 100644 --- a/pages/api/trains/nearby.ts +++ b/pages/api/trains/nearby.ts @@ -14,7 +14,7 @@ type Data = any; const schema = z.object({ latitude: z.string().transform(Number), longitude: z.string().transform(Number), - radius: z.string().regex(/^\d+$/).transform(Number), + radius: z.string().regex(/^\d+$/).transform(Number).optional(), }); export default async function handler( @@ -44,7 +44,7 @@ export default async function handler( }) .sort((a, b) => a.distance - b.distance); - const filtered = mapped.slice(0, 20); + const filtered = mapped.slice(0, 5); // const withInfo = await getTrainData()