Redirecting twice in a single Vue navigation
问题 In my Vue app, a user's homepage depends on their role. To ensure that a user is shown the correct homepage, I use this navigation guard: export default (to, from, next) => { const authService = getAuthService() if (to.path === '/') { // if they've requested the home page, send them to // different pages depending on their role if (authService.isUser()) { next({ name: 'events' }) } else if (authService.isAdmin()) { next({ name: 'admin-events' }) } else { next() } } } Then when a user