mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-30 15:22:39 +00:00
chore: minor improvements for server.js
This commit is contained in:
parent
ddc6369e05
commit
f635b73a0b
@ -85,8 +85,7 @@ export default async context => {
|
||||
if (typeof Component !== 'function' || Component.super === Vue) {
|
||||
return resolve(sanitizeComponent(Component))
|
||||
}
|
||||
const _resolve = (Component) => resolve(sanitizeComponent(Component))
|
||||
Component().then(_resolve).catch(reject)
|
||||
return Component().then(Component => sanitizeComponent(Component))
|
||||
})))
|
||||
} catch (err) {
|
||||
// Throw back error to renderRoute()
|
||||
@ -175,8 +174,8 @@ export default async context => {
|
||||
|
||||
// Call asyncData(context)
|
||||
if (Component.options.asyncData && typeof Component.options.asyncData === 'function') {
|
||||
let promise = promisify(Component.options.asyncData.bind(_this), ctx)
|
||||
promise.then(asyncDataResult => {
|
||||
const promise = promisify(Component.options.asyncData.bind(_this), ctx)
|
||||
.then(asyncDataResult => {
|
||||
context.asyncData[Component.options.name] = asyncDataResult
|
||||
applyAsyncData(Component)
|
||||
return asyncDataResult
|
||||
|
Loading…
Reference in New Issue
Block a user