Permalink
Browse files

fix: redirect without unresolved promise

  • Loading branch information...
pi0 committed Jan 16, 2018
1 parent 97d70f4 commit 24185c97e7a8173932b3d6d0ed19799d5e983c38
Showing with 8 additions and 4 deletions.
  1. +3 −0 lib/app/client.js
  2. +5 −4 lib/app/utils.js
@@ -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')
}
}
}

0 comments on commit 24185c9

Please sign in to comment.