mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +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'],
|
||||
render(h) {
|
||||
if (this.nuxt._redirected) {
|
||||
return h('div', [ 'redirecting.' ])
|
||||
return h('div', [ '<%= messages.redirect %>' ])
|
||||
}
|
||||
// If there is some error
|
||||
if (this.nuxt.err) {
|
||||
|
@ -132,7 +132,8 @@ export async function setContext(app, context) {
|
||||
path = status
|
||||
status = 302
|
||||
}
|
||||
if (path.charAt(0) === '/' && path.charAt(1) !== '/') {
|
||||
// "/absolute/route", "./relative/route" or "../relative/route"
|
||||
if (/(^[.]{1,2}\/)|(^\/(?!\/))/.test(path)) {
|
||||
app.context.next({
|
||||
path: path,
|
||||
query: query,
|
||||
|
@ -127,7 +127,7 @@ test('/redirect -> external link', async t => {
|
||||
}
|
||||
})
|
||||
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 => {
|
||||
|
Loading…
Reference in New Issue
Block a user