Omit blank departure/arrival in schedule details request

Upstream returned HTTP 400 for empty departure/arrival values. Angular
derives them from per-leg data when missing; easier fix here is to
simply not send them — the backend accepts the request without those
query params.
This commit is contained in:
2026-04-18 13:47:19 +03:00
parent 34d74b44c5
commit abc387ac3c
+7 -4
View File
@@ -79,10 +79,13 @@ export async function getScheduleDetails(
arrival: string;
},
): Promise<IScheduleDetailsResponse> {
const query: Record<string, string> = {
departure: params.departure,
arrival: params.arrival,
};
// Omit blank departure/arrival so the upstream doesn't reject the
// request. Angular's details-data-source.service falls back to
// per-leg values when the page-level params are missing; the
// backend accepts the request either way.
const query: Record<string, string> = {};
if (params.departure) query["departure"] = params.departure;
if (params.arrival) query["arrival"] = params.arrival;
for (let i = 0; i < params.flights.length; i++) {
const flight = params.flights[i];