mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 22:25:12 +00:00
fix: redirect without unresolved promise
This commit is contained in:
parent
97d70f46c6
commit
24185c97e7
@ -60,6 +60,9 @@ Vue.config.errorHandler = function (err, vm, info) {
|
|||||||
createApp()
|
createApp()
|
||||||
.then(mountApp)
|
.then(mountApp)
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
|
if (err.message === 'ERR_REDIRECT') {
|
||||||
|
return // Wait for browser to redirect...
|
||||||
|
}
|
||||||
console.error('[nuxt] Error while initializing app', err)
|
console.error('[nuxt] Error while initializing app', err)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -153,10 +153,11 @@ export async function setContext(app, context) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
if (process.client) {
|
if (process.client) {
|
||||||
window.location = path
|
// https://developer.mozilla.org/en-US/docs/Web/API/Location/replace
|
||||||
return new Promise((resolve) => {
|
window.location.replace(path)
|
||||||
// Wait for browser to redirect...
|
|
||||||
})
|
// Throw a redirect error
|
||||||
|
throw new Error('ERR_REDIRECT')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user