From f635b73a0bf4c2a889a2a6f5af6ccacc56318e54 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Mon, 10 Jul 2017 02:11:44 +0430 Subject: [PATCH] chore: minor improvements for server.js --- lib/app/server.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/app/server.js b/lib/app/server.js index e4e3447151..ad5c190fe4 100644 --- a/lib/app/server.js +++ b/lib/app/server.js @@ -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