make code more concise

This commit is contained in:
Markus Schubert 2020-03-26 00:07:04 +01:00
parent c410793351
commit 6c0daa1e3c

View file

@ -24,13 +24,7 @@ router.post('/state', (req, res, next) => {
res.status(400).send(error); res.status(400).send(error);
}; };
authenticator.getAuthenticatedUser(req, (user) => { authenticator.withUser(req, res, (user) => ctrl.create(req.body, user, scb, ecb));
if (user) {
ctrl.create(req.body, user, scb, ecb);
} else {
ecb({ code: 'auth error', message: 'user not logged in.' });
}
});
}); });
router.get('/user', function (req, res, next) { router.get('/user', function (req, res, next) {