Avoid getting stuck in an endless redirect loop...

This commit is contained in:
Dane Everitt 2018-06-16 14:27:23 -07:00
parent 1acedc2de2
commit ca0c35bf82
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53

View File

@ -52,16 +52,6 @@ router.beforeEach((to, from, next) => {
const user = store.getters['auth/getUser'];
// If user is trying to access the authentication endpoints but is already authenticated
// don't try to load them, just send the user to the dashboard.
if (to.path.startsWith('/auth')) {
if (user !== null && compareDate(addHours(dateParse(user.getJWT().iat * 1000), 12), new Date()) >= 0) {
return window.location = '/';
}
return next();
}
// If user is trying to access any of the non-authentication endpoints ensure that they have
// a valid, non-expired JWT.
if (!to.path.startsWith('/auth')) {