Support repeated stopIds and update WienerLinien API URL
This commit is contained in:
@@ -6,13 +6,12 @@ const client = new WienerLinienClient();
|
||||
|
||||
export async function GET(request: NextRequest) {
|
||||
const { searchParams } = new URL(request.url);
|
||||
const stopIdsParam = searchParams.get("stopIds");
|
||||
|
||||
if (!stopIdsParam || stopIdsParam.trim() === "") {
|
||||
const stopIdsList = searchParams.getAll("stopIds");
|
||||
if (stopIdsList.length === 0 || stopIdsList.every((v) => v.trim() === "")) {
|
||||
return NextResponse.json({ error: "Missing 'stopIds' query parameter" }, { status: 400 });
|
||||
}
|
||||
|
||||
const rawIds = stopIdsParam.split(",");
|
||||
const rawIds = stopIdsList.flatMap((param) => param.split(","));
|
||||
const validStopIds = rawIds
|
||||
.map((id) => id.trim())
|
||||
.filter((id) => id.length > 0)
|
||||
|
||||
Reference in New Issue
Block a user