Use url_for for advance fares API URL
Hardcoded path broke when deployed under a subpath such as /paddington-eurostar/; generate the URL server-side with url_for instead. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
35097fda4f
commit
b38951a6a5
1 changed files with 2 additions and 3 deletions
|
|
@ -264,8 +264,7 @@
|
|||
</p>
|
||||
|
||||
<script>
|
||||
var stationCrs = {{ station_crs | tojson }};
|
||||
var travelDate = {{ travel_date | tojson }};
|
||||
var advanceFaresUrl = {{ url_for('api_advance_fares', station_crs=station_crs, travel_date=travel_date) | tojson }};
|
||||
var cachedAdvanceFares = {{ cached_advance_fares | tojson }};
|
||||
|
||||
function updatePrices() {
|
||||
|
|
@ -315,7 +314,7 @@ function loadAdvanceFares() {
|
|||
btn.disabled = true;
|
||||
btn.textContent = 'Loading\u2026';
|
||||
|
||||
fetch('/api/advance_fares/' + stationCrs + '/' + travelDate)
|
||||
fetch(advanceFaresUrl)
|
||||
.then(function(r) { return r.json(); })
|
||||
.then(function(data) {
|
||||
if (data.error) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue