fix(auth): Fix auth flow for the client app

This commit is contained in:
Bouncey
2018-10-24 00:24:48 +01:00
committed by mrugesh mohapatra
parent a656cbf98a
commit c08bb95ea8
19 changed files with 348 additions and 212 deletions

View File

@ -1,15 +1,16 @@
import accepts from 'accepts';
import { homeLocation } from '../../../config/env.json';
export default function fourOhFour(app) {
app.all('*', function(req, res) {
const accept = accepts(req);
const type = accept.type('html', 'json', 'text');
const { path } = req;
if (type === 'html') {
req.flash('danger', `We couldn't find path ${ path }`);
return res.render('404', { title: '404'});
req.flash('danger', `We couldn't find path ${path}`);
return res.redirectWithFlash(`${homeLocation}/404`);
}
if (type === 'json') {