shift-org/shift-docs

"Show additional events" button always fetches 10 more days, regardless of the previously requested range

Opened this issue · 0 comments

Fetch any date range other than the default 10 day range, e.g. https://www.shift2bikes.org/calendar/?startdate=2024-06-28&enddate=2024-06-28 (1 day). When you press "Show additional events" it always loads 10 more days, ignoring the size of your previously requested range.

Instead, we should use the same range length for subsequent requests. Note that the pagination.next URL in the events API response does already do this, but the frontend isn't consuming that value. e.g. Response for https://www.shift2bikes.org/api/events.php?startdate=2024-06-28&enddate=2024-06-28:

{
  "events": [
    …
  ],
  "pagination": {
    "start": "2024-06-28",
    "end": "2024-06-28",
    "range": 0,
    "events": 13,
    "next": "https://shift2bikes.org/api/events.php?startdate=2024-06-29&enddate=2024-06-29"
  }
}

(For "range": 0, see #567.)