From 6c0daa1e3c69e86870572c040d05504c30e1fbc0 Mon Sep 17 00:00:00 2001 From: Markus Schubert Date: Thu, 26 Mar 2020 00:07:04 +0100 Subject: [PATCH] make code more concise --- app/routes/api.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) 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) {