diff options
author | Noah Loomans <noahloomans@gmail.com> | 2018-02-09 14:34:45 +0100 |
---|---|---|
committer | Noah Loomans <noahloomans@gmail.com> | 2018-02-09 14:34:45 +0100 |
commit | 8d5bccc8984618c9282e9592882835819306fa07 (patch) | |
tree | 173a9e1c0317a1dce656afaef9979b18cef75c2b /src/server/routes | |
parent | 3989338f0fc2bd394716b4199192b869b8e9bf3b (diff) |
Send basis schedule week to client
Diffstat (limited to 'src/server/routes')
-rw-r--r-- | src/server/routes/index.js | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/server/routes/index.js b/src/server/routes/index.js index 7e97fea..d58962d 100644 --- a/src/server/routes/index.js +++ b/src/server/routes/index.js @@ -5,7 +5,7 @@ const getMeetingpointData = require('../lib/getMeetingpointData'); /* GET home page. */ router.get(['/', '/s/*', '/t/*', '/r/*', '/c/*'], (req, res) => { - getMeetingpointData().then((data) => { + getMeetingpointData().then(({ users, dailyScheduleWeeks, basisScheduleWeeks }) => { const isBeta = process.env.BETA === '1'; const flags = []; @@ -17,10 +17,16 @@ router.get(['/', '/s/*', '/t/*', '/r/*', '/c/*'], (req, res) => { } 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)}`; + const usersStr = `var USERS = ${JSON.stringify(users)};`; + const dailyScheduleWeeksStr = `var DAGROOSTER_WEEKS = ${JSON.stringify(dailyScheduleWeeks)}`; + const basisScheduleWeeksStr = `var BASISROOSTER_WEEKS = ${JSON.stringify(basisScheduleWeeks)}`; - res.render('index', { flagsStr, usersStr, validWeekNumbersStr }); + res.render('index', { + flagsStr, + usersStr, + dailyScheduleWeeksStr, + basisScheduleWeeksStr, + }); }).catch(() => { console.error('Unable to get user info, emergency redirect!'); res.render('redirect'); |