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()
|
||||
.then(mountApp)
|
||||
.catch(err => {
|
||||
if (err.message === 'ERR_REDIRECT') {
|
||||
return // Wait for browser to redirect...
|
||||
}
|
||||
console.error('[nuxt] Error while initializing app', err)
|
||||
})
|
||||
|
||||
|
@ -153,10 +153,11 @@ export async function setContext(app, context) {
|
||||
})
|
||||
}
|
||||
if (process.client) {
|
||||
window.location = path
|
||||
return new Promise((resolve) => {
|
||||
// Wait for browser to redirect...
|
||||
})
|
||||
// https://developer.mozilla.org/en-US/docs/Web/API/Location/replace
|
||||
window.location.replace(path)
|
||||
|
||||
// Throw a redirect error
|
||||
throw new Error('ERR_REDIRECT')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user