lamassu-server/lib/middlewares/operatorId.js
2021-11-19 18:01:04 +00:00

15 lines
339 B
JavaScript

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