just render minutes if queried by stop and line
This commit is contained in:
@@ -22,6 +22,14 @@ departuresRouter.get('/departures', (req, res) => {
|
||||
}));
|
||||
}
|
||||
|
||||
if (stop && line) {
|
||||
const minutes = departures.flatMap((stop) => {
|
||||
return stop.departures.flatMap((d) => d.next);
|
||||
});
|
||||
|
||||
return res.json(minutes);
|
||||
}
|
||||
|
||||
return res.json(departures);
|
||||
} catch (error) {
|
||||
console.error('Error reading file:', error);
|
||||
|
||||
Reference in New Issue
Block a user