diff options
Diffstat (limited to 'routes/index.js')
-rw-r--r-- | routes/index.js | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/routes/index.js b/routes/index.js index 0fc0d30..3718015 100644 --- a/routes/index.js +++ b/routes/index.js @@ -4,9 +4,9 @@ const express = require('express') const router = express.Router() const getUserIndex = require('../lib/getUserIndex') -getUserIndex().then(users => { - /* GET home page. */ - router.get(['/', '/s/*', '/t/*', '/r/*', '/c/*'], function (req, res, next) { +/* GET home page. */ +router.get(['/', '/s/*', '/t/*', '/r/*', '/c/*'], function (req, res, next) { + getUserIndex().then(users => { const isBeta = process.env.BETA === '1' let flags = [] @@ -21,12 +21,8 @@ getUserIndex().then(users => { const usersStr = `var USERS = ${JSON.stringify(users)};` res.render('index', { flagsStr, usersStr, isBeta }) - }) -}, error => { - console.error('Unable to get user info, emergency redirect!') - console.error('Error:', error) - - router.get(['/', '/s/*', '/t/*', '/r/*', '/c/*'], function (req, res, next) { + }).catch(function () { + console.error('Unable to get user info, emergency redirect!') res.redirect('http://www.meetingpointmco.nl/Roosters-AL/doc/') }) }) |