fix: error page rendering before redirect (#3782)

* fix: error page rendering before redirect

* fix: cancel redirect after redirect to external link

* refactor: simplify ERR_REDIRECT

* refactor: simplify ERR_REDIRECT

* refactor: trigger routeChanged when redirect external link
This commit is contained in:
Clark Du 2018-08-22 14:10:18 +01:00 committed by GitHub
parent 820f0fae1a
commit ef85723fe6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 3 deletions

View File

@ -71,9 +71,6 @@ Vue.config.errorHandler = (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)
})
@ -392,6 +389,8 @@ async function render (to, from, next) {
} catch (error) {
if (!error) {
error = {}
} else if (error.message === 'ERR_REDIRECT') {
return this.$nuxt.$emit('routeChanged', to, from, error)
}
_lastPaths = []
const errorResponseStatus = (error.response && error.response.status)