Bugfix: Unauthorised request to /timetable/train routes caused crash

Signed-off-by: Fred Boniface <fred@fjla.uk>
This commit is contained in:
Fred Boniface 2023-07-15 19:59:50 +01:00
parent df0eb0451f
commit a865410b31

View File

@ -4,7 +4,7 @@ async function getByHeadcodeToday(req, res, next){
if (!req.isAuthed) { if (!req.isAuthed) {
const err = new Error('Unauthorized'); const err = new Error('Unauthorized');
err.status = 401; err.status = 401;
throw err; next(err)
} }
try { try {
var searchHeadcode = req.params.id; var searchHeadcode = req.params.id;
@ -20,7 +20,7 @@ async function get(req, res, next) {
if (!req.isAuthed) { if (!req.isAuthed) {
const err = new Error('Unauthorized'); const err = new Error('Unauthorized');
err.status = 401; err.status = 401;
throw err; next(err);
} }
let date = req.params.date; let date = req.params.date;
let searchType = req.params.searchType; let searchType = req.params.searchType;