mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-30 23:32:38 +00:00
Fix redirected
This commit is contained in:
parent
749673c99b
commit
66c5aad09d
@ -25,9 +25,9 @@ export default context => {
|
|||||||
// create context.next for simulate next() of beforeEach() when wanted to redirect
|
// create context.next for simulate next() of beforeEach() when wanted to redirect
|
||||||
context.redirected = false
|
context.redirected = false
|
||||||
context.next = function (opts) {
|
context.next = function (opts) {
|
||||||
|
context.redirected = opts
|
||||||
// if nuxt generate
|
// if nuxt generate
|
||||||
if (!context.res) {
|
if (!context.res) {
|
||||||
context.redirected = opts
|
|
||||||
context.nuxt.serverRendered = false
|
context.nuxt.serverRendered = false
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,9 @@ export function render (req, res) {
|
|||||||
return this.renderRoute(req.url, context)
|
return this.renderRoute(req.url, context)
|
||||||
})
|
})
|
||||||
.then(({ html, error, redirected }) => {
|
.then(({ html, error, redirected }) => {
|
||||||
if (redirected) return html
|
if (redirected) {
|
||||||
|
return html
|
||||||
|
}
|
||||||
if (error) {
|
if (error) {
|
||||||
res.statusCode = context.nuxt.error.statusCode || 500
|
res.statusCode = context.nuxt.error.statusCode || 500
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user