chore: minor improvements for server.js

This commit is contained in:
Pooya Parsa 2017-07-10 02:11:44 +04:30
parent ddc6369e05
commit f635b73a0b

View File

@ -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