fix(router): resolve redirect errors (#7912)

This commit is contained in:
Ahad Birang 2020-08-14 03:01:00 +04:30 committed by GitHub
parent 5fdfba2279
commit e03563b3dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -247,9 +247,9 @@ async function createApp(ssrContext, config = {}) {
if (process.server && ssrContext && ssrContext.url) {
await new Promise((resolve, reject) => {
router.push(ssrContext.url, resolve, (err) => {
// https://github.com/vuejs/vue-router/blob/v3.3.4/src/history/errors.js
// https://github.com/vuejs/vue-router/blob/v3.4.3/src/util/errors.js
if (!err._isRouter) return reject(err)
if (err.type !== 1 /* NavigationFailureType.redirected */) return resolve()
if (err.type !== 2 /* NavigationFailureType.redirected */) return resolve()
// navigated to a different route in router guard
const unregister = router.afterEach(async (to, from) => {