-
-
Notifications
You must be signed in to change notification settings - Fork 5k
Closed
Description
Version
3.4.3
Reproduction link
Steps to reproduce
vue.runtime.esm.js?2b0e:1888 Error: Redirected when going from "/home" to "/product" via a navigation guard.
home.vue
this.$router.push('/product')
a router guard permission.js
async function initRouter (router) {
router.beforeEach(async (to, from, next) => {
NProgress.done(true)
NProgress.remove()
NProgress.start()
const token = store.state.user.token
const info = store.state.user.info
if (to.meta.requireAuth && !token) {
return next({ // Here is an error,Multiple redirection?
path: '/login',
query: { redirect: to.fullPath },
})
} else if (to.path === '/login' && token) {
return next({ path: '/home' })
}
if (token && !info) {
await store.dispatch('user/getInfo')
}
store.commit('user/SET_INIT', true)
next()
})
router.afterEach(() => {
NProgress.done()
})
}
What is expected?
When redirecting, modify the redirect
What is actually happening?
error
Metadata
Metadata
Assignees
Labels
No labels