mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 16:12:12 +00:00
Polish app/server.js
This commit is contained in:
parent
78400042ef
commit
f07d9855b6
@ -4,7 +4,7 @@ import { stringify } from 'querystring'
|
|||||||
import { omit } from 'lodash'
|
import { omit } from 'lodash'
|
||||||
import middleware from './middleware'
|
import middleware from './middleware'
|
||||||
import { createApp, NuxtError } from './index'
|
import { createApp, NuxtError } from './index'
|
||||||
import { applyAsyncData, sanitizeComponent, getMatchedComponents, getContext, middlewareSeries, promisify, urlJoin} from './utils'
|
import { applyAsyncData, sanitizeComponent, getMatchedComponents, getContext, middlewareSeries, promisify, urlJoin } from './utils'
|
||||||
|
|
||||||
const debug = require('debug')('nuxt:render')
|
const debug = require('debug')('nuxt:render')
|
||||||
debug.color = 4 // force blue color
|
debug.color = 4 // force blue color
|
||||||
@ -153,7 +153,8 @@ export default async context => {
|
|||||||
if (typeof Component.options.validate !== 'function') return
|
if (typeof Component.options.validate !== 'function') return
|
||||||
isValid = Component.options.validate({
|
isValid = Component.options.validate({
|
||||||
params: context.route.params || {},
|
params: context.route.params || {},
|
||||||
query: context.route.query || {}<%= (store ? ', store: ctx.store' : '') %>
|
query: context.route.query || {},
|
||||||
|
<%= (store ? 'store: ctx.store' : '') %>
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
// ...If .validate() returned false
|
// ...If .validate() returned false
|
||||||
@ -195,7 +196,7 @@ export default async context => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return Promise.all(promises).then(data => {
|
return Promise.all(promises).then(data => {
|
||||||
// If not dyanmic component, return data directly
|
// If no dynamic component, return data directly
|
||||||
if (Object.keys(_this.components).length === 0) {
|
if (Object.keys(_this.components).length === 0) {
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user