Merge branch 'dev'
This commit is contained in:
commit
9099020e56
|
@ -1,3 +1,4 @@
|
||||||
|
const config = require('settings/config');
|
||||||
const cal = require('calendar');
|
const cal = require('calendar');
|
||||||
const redirectIfNotLogged = require('auth/views').redirectIfNotLogged;
|
const redirectIfNotLogged = require('auth/views').redirectIfNotLogged;
|
||||||
|
|
||||||
|
@ -38,7 +39,20 @@ module.exports.total = redirectIfNotLogged('total', function(req, res, render) {
|
||||||
render('total.pug');
|
render('total.pug');
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports.totalTable = function(req, res, render) {
|
module.exports.totalTable = function(req, res, render, next) {
|
||||||
|
if (req.session.user === undefined) {
|
||||||
|
res.status(404);
|
||||||
|
|
||||||
|
res.setHeader('Content-Type', 'text/html');
|
||||||
|
|
||||||
|
res.render(config.BASE_DIR + '/templates/404.pug', res.locals, function(err, result) {
|
||||||
|
if (err)
|
||||||
|
console.log(err);
|
||||||
|
res.send(result);
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
computeUserTable(req.session.user, (result) => {
|
computeUserTable(req.session.user, (result) => {
|
||||||
res.locals.courses = result.courses;
|
res.locals.courses = result.courses;
|
||||||
res.locals.total = result.total;
|
res.locals.total = result.total;
|
||||||
|
|
2
index.js
2
index.js
|
@ -53,6 +53,8 @@ function startServer() {
|
||||||
|
|
||||||
// When route not found, raise not found
|
// When route not found, raise not found
|
||||||
app.use(function(req, res) {
|
app.use(function(req, res) {
|
||||||
|
|
||||||
|
res.status(404);
|
||||||
res.setHeader('Content-Type', 'text/html');
|
res.setHeader('Content-Type', 'text/html');
|
||||||
|
|
||||||
res.render(config.BASE_DIR + '/templates/404.pug', res.locals, function(err, result) {
|
res.render(config.BASE_DIR + '/templates/404.pug', res.locals, function(err, result) {
|
||||||
|
|
Loading…
Reference in New Issue