about summary refs log tree commit diff
path: root/streaming/index.js
diff options
context:
space:
mode:
authorGavin Mogan <github@gavinmogan.com>2017-04-10 15:36:03 -0700
committerEugen <eugen@zeonfederated.com>2017-04-11 00:36:03 +0200
commit3672a799d4bf9011bc665b6d8f55e58031513527 (patch)
tree52699d8e726239721918869e85ffeefba8c0cac9 /streaming/index.js
parent3fd5385e7b038bce4da566bcd193f0fd1e2c5383 (diff)
Dev Tooling fixes (eslint/editorconfig) (#1398)
* Add eslint to dev dependancies so it gets installed for the repo

yarn add --dev eslint babel-eslint eslint-plugin-reac

project specific version of eslint, you can globally install eslint-cli
if you want the global runtime, or add .bin to your path

* fix eslint errors about inconsitent returns

* eslint ignore the same as git ignore. allows for eslint .

* Add editorconfig file so everyones editor will be setup to follow the same standards
Diffstat (limited to 'streaming/index.js')
-rw-r--r--streaming/index.js15
1 files changed, 10 insertions, 5 deletions
diff --git a/streaming/index.js b/streaming/index.js
index 7edf6203f..a1e7eaca7 100644
--- a/streaming/index.js
+++ b/streaming/index.js
@@ -87,21 +87,24 @@ const setRequestId = (req, res, next) => {
 const accountFromToken = (token, req, next) => {
   pgPool.connect((err, client, done) => {
     if (err) {
-      return next(err)
+      next(err)
+      return
     }
 
     client.query('SELECT oauth_access_tokens.resource_owner_id, users.account_id FROM oauth_access_tokens INNER JOIN users ON oauth_access_tokens.resource_owner_id = users.id WHERE oauth_access_tokens.token = $1 LIMIT 1', [token], (err, result) => {
       done()
 
       if (err) {
-        return next(err)
+        next(err)
+        return
       }
 
       if (result.rows.length === 0) {
         err = new Error('Invalid access token')
         err.statusCode = 401
 
-        return next(err)
+        next(err)
+        return
       }
 
       req.accountId = result.rows[0].account_id
@@ -113,7 +116,8 @@ const accountFromToken = (token, req, next) => {
 
 const authenticationMiddleware = (req, res, next) => {
   if (req.method === 'OPTIONS') {
-    return next()
+    next()
+    return
   }
 
   const authorization = req.get('Authorization')
@@ -122,7 +126,8 @@ const authenticationMiddleware = (req, res, next) => {
     const err = new Error('Missing access token')
     err.statusCode = 401
 
-    return next(err)
+    next(err)
+    return
   }
 
   const token = authorization.replace(/^Bearer /, '')