add component options to context

This commit is contained in:
cj 2017-08-10 14:13:59 -05:00
parent 127155d61a
commit 77e069ae27
2 changed files with 7 additions and 3 deletions

View File

@ -300,7 +300,9 @@ async function render (to, from, next) {
// Call fetch(context)
if (hasFetch) {
let p = Component.options.fetch(context)
let p = Component.options.fetch({
...context, options: Component.options
})
if (!p || (!(p instanceof Promise) && (typeof p.then !== 'function'))) {
p = Promise.resolve(p)
}

View File

@ -182,7 +182,9 @@ export default async context => {
// Call fetch(context)
if (Component.options.fetch) {
promises.push(Component.options.fetch(ctx))
promises.push(Component.options.fetch({
...ctx, options: Component.options
}))
}
else {
promises.push(null)