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