mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-18 14:41:25 +00:00
fix(router): resolve redirect errors (#7912)
This commit is contained in:
parent
5fdfba2279
commit
e03563b3dc
@ -247,9 +247,9 @@ async function createApp(ssrContext, config = {}) {
|
|||||||
if (process.server && ssrContext && ssrContext.url) {
|
if (process.server && ssrContext && ssrContext.url) {
|
||||||
await new Promise((resolve, reject) => {
|
await new Promise((resolve, reject) => {
|
||||||
router.push(ssrContext.url, resolve, (err) => {
|
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._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
|
// navigated to a different route in router guard
|
||||||
const unregister = router.afterEach(async (to, from) => {
|
const unregister = router.afterEach(async (to, from) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user