Skip to content

Commit

Permalink
Merge branch 'main' into deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
davwheat committed Nov 3, 2023
2 parents 8a4ac4e + 84b5c06 commit 4b09576
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions src/announcement-data/systems/stations/KeTechPhil.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3934,22 +3934,27 @@ function LiveTrainAnnouncements({ nextTrainHandler, system }: LiveTrainAnnouncem

console.log('[Live Trains] Checking for new services')

const resp = await fetch(
`https://national-rail-api.davwheat.dev/departures/${selectedCrs}?expand=true&numServices=3&timeOffset=0&timeWindow=${MIN_TIME_TO_ANNOUNCE}`,
)
try {
const resp = await fetch(
`https://national-rail-api.davwheat.dev/departures/${selectedCrs}?expand=true&numServices=3&timeOffset=0&timeWindow=${MIN_TIME_TO_ANNOUNCE}`,
)

if (!resp.ok) {
console.warn("[Live Trains] Couldn't fetch data from API")
return
}
if (!resp.ok) {
console.warn("[Live Trains] Couldn't fetch data from API")
return
}

let services
let services

try {
const data = await resp.json()
services = data.trainServices
} catch {
console.warn("[Live Trains] Couldn't parse JSON from API")
try {
const data = await resp.json()
services = data.trainServices
} catch {
console.warn("[Live Trains] Couldn't parse JSON from API")
return
}
} catch (e) {
console.warn('[Live Trains] Failed to fetch')
return
}

Expand Down Expand Up @@ -4083,8 +4088,8 @@ function LiveTrainAnnouncements({ nextTrainHandler, system }: LiveTrainAnnouncem
This is a beta feature, and isn't complete or fully functional. Please report any issues you face on GitHub.
</p>
<p style={{ margin: '16px 0' }}>
This page will auto-announce all departures in the next {MIN_TIME_TO_ANNOUNCE} minutes from the selected station. Departures outside this timeframe will
appear on the board below, but won't be announced until closer to the time.
This page will auto-announce all departures in the next {MIN_TIME_TO_ANNOUNCE} minutes from the selected station. Departures outside this
timeframe will appear on the board below, but won't be announced until closer to the time.
</p>
<p style={{ margin: '16px 0' }}>At the moment, we also won't announce services which:</p>
<ul className="list" style={{ margin: '16px 16px' }}>
Expand Down

0 comments on commit 4b09576

Please sign in to comment.