feat(router): prevent redirection from public landing pages on session expiration
This commit is contained in:
@@ -43,6 +43,12 @@ const router = createRouter({
|
||||
});
|
||||
|
||||
router.beforeEach(async (to, from, next) => {
|
||||
// These are public entry pages. They must never be redirected because a
|
||||
// persisted login has expired while the application is starting up.
|
||||
if (to.meta?.publicLanding) {
|
||||
return next();
|
||||
}
|
||||
|
||||
if (to.matched.some(record => record.meta.requiresAuth)) {
|
||||
if (!store.getters.isLoggedIn) {
|
||||
return next('/');
|
||||
|
||||
Reference in New Issue
Block a user