From ef85723fe6411f36985f3206c31154286116207f Mon Sep 17 00:00:00 2001 From: Clark Du Date: Wed, 22 Aug 2018 14:10:18 +0100 Subject: [PATCH] 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 --- lib/app/client.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/app/client.js b/lib/app/client.js index 371ab1978f..6dc71d63b0 100644 --- a/lib/app/client.js +++ b/lib/app/client.js @@ -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)