vue-session
vue-session copied to clipboard
Session Timeout
How to set session timeout parameter?
there is no builtin timeout option. we can work on it for future releases
help me to know if this feature is available?
No yet. I guess.
looks like still not available
I ended up with alternate solution you guys might use this, this below code helped me lot.
Just place in main.js file where your router has began.
router.beforeEach((to, from, next) => {
if (to.matched.some(record => record.meta.requiresAuth)) {
const token = router.app.$session.exists('userProfile');
let timeBefore = moment(router.app.$session.get('_timeout').date);
let timeNow = moment(new Date());
let timeDiff = moment.duration(timeNow.diff(timeBefore)).asMinutes();
if (timeDiff > router.app.$session.get('_timeout').limit) {
next({ path: '/login' });
} else {
next();
}
} else {
next();
}
});
it was not fixed?