Friday, 7 September 2018

Expression Session bug

I have a small issue which I can't figure out how to solve. When user logs in, he'll be redirected to the home page. However, the nav bar which should show the username is not loading properly. I have to refresh one time in order for it to show the changes. Same goes to logging out, I have to refresh after being redirected to see the different nav bar.​​app.use(expressSession({secret: "123test",store: sequelizeSessionStore,resave: false,saveUninitialized: false}));​Middleware:app.use(function(req, res, next) {res.locals.session = req.session.user;res.locals.loggedIn = req.session.loggedIn;next();});​Log out function:exports.logout = function(req, res, next) {req.session.loggedIn = false;res.redirect("/login");};

Submitted September 07, 2018 at 10:35AM by andyprince

No comments:

Post a Comment