diff options
Diffstat (limited to 'routes')
-rw-r--r-- | routes/index.js | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/routes/index.js b/routes/index.js index d496b3c..223d97f 100644 --- a/routes/index.js +++ b/routes/index.js @@ -6,6 +6,10 @@ const getMeetingpointData = require('../lib/getMeetingpointData') /* GET home page. */ router.get('/', function (req, res, next) { + const baseMeetingpointUrl = process.env.SCHOOL_LEVEL === 'mavo' + ? 'http://www.meetingpointmco.nl/Roosters-AL/TOSweb' + : 'http://www.meetingpointmco.nl/Roosters-AL/doc'; + getMeetingpointData().then(data => { let flags = [] if (req.query.nfd != null) { @@ -15,11 +19,12 @@ router.get('/', function (req, res, next) { const flagsStr = `var FLAGS = ${JSON.stringify(flags)};` const usersStr = `var USERS = ${JSON.stringify(data.users)};` const validWeekNumbersStr = `var VALID_WEEK_NUMBERS = ${JSON.stringify(data.validWeekNumbers)}` - res.render('index', { flagsStr, usersStr, validWeekNumbersStr }) + res.render('index', { baseMeetingpointUrl, flagsStr, usersStr, validWeekNumbersStr }) }).catch(function () { console.error('Unable to get user info, emergency redirect!') - // res.redirect('http://www.meetingpointmco.nl/Roosters-AL/doc/') - res.render('redirect') + res.render('redirect', { + baseMeetingpointUrl, + }) }) }) |