@autobusal/routes-order 1.30.0 → 1.30.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.30.1
4
+
5
+ ### Fixed
6
+
7
+ - **Step 3 could never list a single return leg.** `useGetReturns` spread the
8
+ search form straight into the query string, so the return date went over as
9
+ `_return` — the form's name for it, because `return` is a reserved word in
10
+ JS — while the API validates `return`. Every request answered
11
+ `422 The return field is required`, and "Select a Return Schedule" was empty
12
+ for every round trip ever searched. The order builder in the same file has
13
+ always done this mapping (`order.return = step1._return`); only this call
14
+ was missed.
15
+
16
+ Paired with an obtapi fix — `Routes\Search\Returns::find()` returned nothing
17
+ on its success path — so the step was broken twice over and neither failure
18
+ could be seen past the other.
19
+
3
20
  ## 1.30.0
4
21
 
5
22
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autobusal/routes-order",
3
- "version": "1.30.0",
3
+ "version": "1.30.1",
4
4
  "author": "Ferjolt Ozuni",
5
5
  "type": "module",
6
6
  "main": "index.ts"
package/services.ts CHANGED
@@ -47,6 +47,18 @@ export const useGetAlternatives = (data: RoutesSearchForm, enabled: boolean): Us
47
47
  })
48
48
  );
49
49
 
50
+ /**
51
+ * The return legs on offer for an already-chosen outbound.
52
+ *
53
+ * Edited: Ferjolt Ozuni - Date: 2026-08-05
54
+ * The return date goes over as `return`. The form calls it `_return`
55
+ * because `return` is a reserved word in JS, and spreading the form
56
+ * straight into the query string therefore sent a field the API does not
57
+ * know while omitting the one it validates - so this request answered 422
58
+ * "The return field is required" every single time, and step 3 could never
59
+ * list anything. The order builder below has always done this mapping
60
+ * (`order.return = step1._return`); only this call was missed.
61
+ */
50
62
  export const useGetReturns = (data: RoutesSearchForm, departure: FoundData): UseQueryResult<FoundData[]> => (
51
63
  useQuery({
52
64
  queryKey: ['search-routes-step3', { data }],
@@ -55,6 +67,7 @@ export const useGetReturns = (data: RoutesSearchForm, departure: FoundData): Use
55
67
  .get('/api/routes/search/return', {
56
68
  params: {
57
69
  ...data,
70
+ return: data._return,
58
71
  operator_id: departure.operator.id
59
72
  }
60
73
  })