aboutsummaryrefslogtreecommitdiff
path: root/src/server/routes/index.js
diff options
context:
space:
mode:
authorNoah Loomans <noahloomans@gmail.com>2018-07-07 17:34:02 +0200
committerNoah Loomans <noahloomans@gmail.com>2018-07-07 17:34:02 +0200
commit5c265c04ad513d845a41c7866c3ed231c8d5e68e (patch)
tree9a86b66958e59e4a07d0c8e10731667b05990816 /src/server/routes/index.js
parent8b1f29f2802a081a67151e47b9c52803d7cc568a (diff)
server: Use database for userssync-with-db
Diffstat (limited to 'src/server/routes/index.js')
-rw-r--r--src/server/routes/index.js26
1 files changed, 4 insertions, 22 deletions
diff --git a/src/server/routes/index.js b/src/server/routes/index.js
index d647210..b0e86ee 100644
--- a/src/server/routes/index.js
+++ b/src/server/routes/index.js
@@ -21,31 +21,13 @@
const express = require('express');
const router = express.Router();
-const getScheduleData = require('../lib/schools/hetmml/getScheduleData');
+const { getUsers } = require('../../shared/lib/db');
/* GET home page. */
-router.get(['/', '/s/*', '/t/*', '/r/*', '/c/*'], (req, res) => {
- getScheduleData().then(({ users, dailyScheduleWeeks, basisScheduleWeeks }) => {
- const isBeta = process.env.BETA === '1';
-
- const flags = [];
- if (isBeta) {
- flags.push('BETA');
- flags.push('NO_FEATURE_DETECT');
- } else if (req.query.nfd != null) {
- flags.push('NO_FEATURE_DETECT');
- }
-
- const flagsStr = `var FLAGS = ${JSON.stringify(flags)};`;
- const usersStr = `var USERS = ${JSON.stringify(users)};`;
- const dailyScheduleWeeksStr = `var DAGROOSTER_WEEKS = ${JSON.stringify(dailyScheduleWeeks)}`;
- const basisScheduleWeeksStr = `var BASISROOSTER_WEEKS = ${JSON.stringify(basisScheduleWeeks)}`;
-
+router.get(['/', '/student/*', '/teacher/*', '/room/*', '/class/*'], (req, res) => {
+ getUsers().then((users) => {
res.render('index', {
- flagsStr,
- usersStr,
- dailyScheduleWeeksStr,
- basisScheduleWeeksStr,
+ usersStr: JSON.stringify(users),
});
});
// .catch(() => {