lamassu-server/lib/middlewares/operatorId.js
2022-05-02 12:19:29 +01:00

15 lines
361 B
JavaScript

const { getOperatorId } = require('../operator')
function findOperatorId (req, res, next) {
return getOperatorId('middleware')
.then(operatorId => {
res.locals.operatorId = operatorId
return next()
})
.catch(e => {
console.error('Error while computing operator id\n' + e)
next(e)
})
}
module.exports = findOperatorId