mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 14:15:13 +00:00
refactor: move redirect message to option.messges
This commit is contained in:
parent
97eaa1b671
commit
40b9d23ea9
@ -8,7 +8,7 @@ export default {
|
|||||||
props: ['nuxtChildKey'],
|
props: ['nuxtChildKey'],
|
||||||
render(h) {
|
render(h) {
|
||||||
if (this.nuxt._redirected) {
|
if (this.nuxt._redirected) {
|
||||||
return h('div', [ 'redirecting.' ])
|
return h('div', [ '<%= messages.redirect %>' ])
|
||||||
}
|
}
|
||||||
// If there is some error
|
// If there is some error
|
||||||
if (this.nuxt.err) {
|
if (this.nuxt.err) {
|
||||||
|
@ -132,7 +132,8 @@ export async function setContext(app, context) {
|
|||||||
path = status
|
path = status
|
||||||
status = 302
|
status = 302
|
||||||
}
|
}
|
||||||
if (path.charAt(0) === '/' && path.charAt(1) !== '/') {
|
// "/absolute/route", "./relative/route" or "../relative/route"
|
||||||
|
if (/(^[.]{1,2}\/)|(^\/(?!\/))/.test(path)) {
|
||||||
app.context.next({
|
app.context.next({
|
||||||
path: path,
|
path: path,
|
||||||
query: query,
|
query: query,
|
||||||
|
@ -127,7 +127,7 @@ test('/redirect -> external link', async t => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
t.is(headers.Location, 'https://nuxtjs.org')
|
t.is(headers.Location, 'https://nuxtjs.org')
|
||||||
t.true(html.includes('<div>redirecting.</div>'))
|
t.true(html.includes('<div>Redirecting to external page.</div>'))
|
||||||
})
|
})
|
||||||
|
|
||||||
test('/special-state -> check window.__NUXT__.test = true', async t => {
|
test('/special-state -> check window.__NUXT__.test = true', async t => {
|
||||||
|
Loading…
Reference in New Issue
Block a user