diff --git a/app/routes/api.js b/app/routes/api.js index c5d89bc..67474b6 100644 --- a/app/routes/api.js +++ b/app/routes/api.js @@ -24,13 +24,7 @@ router.post('/state', (req, res, next) => { res.status(400).send(error); }; - authenticator.getAuthenticatedUser(req, (user) => { - if (user) { - ctrl.create(req.body, user, scb, ecb); - } else { - ecb({ code: 'auth error', message: 'user not logged in.' }); - } - }); + authenticator.withUser(req, res, (user) => ctrl.create(req.body, user, scb, ecb)); }); router.get('/user', function (req, res, next) {