Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 21 additions & 18 deletions src/BusTimes.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,28 @@ const BusTimes = () => {
const [busStation, setBusStations] = useState([]);

useEffect(() => {
const generateStops = setInterval(() => {
service
.getDeparturesBetweenStopPlaces(
/*

Finn ID til dine stoppesteder her:
https://developer.entur.org/pages-geocoder-intro

async function generateStops() {
const stops = await service.getDeparturesBetweenStopPlaces(
/*

Finn ID til dine stoppesteder her:
https://developer.entur.org/pages-geocoder-intro

*/
"NSR:StopPlace:60890",
"NSR:StopPlace:44085",
// Viser her 9 resultat; endre dette om ønskelig
{ limit: 9 }
)
.then((data) => setBusStations(data));
}, 10000);

return () => clearInterval(generateStops);
}, []);
'NSR:StopPlace:60890',
'NSR:StopPlace:44085',
// Viser her 9 resultat; endre dette om ønskelig
{ limit: 9 }
)
setBusStations(stops)
console.log('Setting stops')
}

generateStops()
const newStopsInterval = setInterval(generateStops, 1000)

return () => clearInterval(newStopsInterval)
}, [])

return (
<div className="routes">
Expand Down