Skip to content

Commit

Permalink
lightRail should respect status field from API
Browse files Browse the repository at this point in the history
  • Loading branch information
desmondlsl committed Oct 26, 2024
1 parent e2b2020 commit e3618ea
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/lightRail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ export default function fetchEtas({
},
)
.then((response) => response.json())
.then(({ platform_list }) =>
platform_list.reduce(
.then(({ status, platform_list }) => {
if (status === 0) return [];
return platform_list.reduce(
(acc: Eta[], { route_list, platform_id }: any) => [
...acc,
...route_list
Expand Down Expand Up @@ -74,8 +75,8 @@ export default function fetchEtas({
}, []),
],
[],
),
)
)
})
.catch((e) => {
console.error(e);
return [];
Expand Down

0 comments on commit e3618ea

Please sign in to comment.