From 8680046c4e59e2296de6add1237f59745aa49e03 Mon Sep 17 00:00:00 2001 From: taehoon Date: Thu, 14 Feb 2019 03:12:52 -0500 Subject: Pass down slots into wrapped components --- src/hocs/with_subscription/with_subscription.js | 46 ++++++++++++++++--------- 1 file changed, 30 insertions(+), 16 deletions(-) (limited to 'src/hocs/with_subscription/with_subscription.js') diff --git a/src/hocs/with_subscription/with_subscription.js b/src/hocs/with_subscription/with_subscription.js index 960c6d71..42ede7be 100644 --- a/src/hocs/with_subscription/with_subscription.js +++ b/src/hocs/with_subscription/with_subscription.js @@ -13,25 +13,39 @@ const withSubscription = ({ const props = reject(originalProps, v => v === 'content') return Vue.component('withSubscription', { + props: [ + ...props, + 'refresh' // boolean saying to force-fetch data whenever created + ], render (createElement) { - const props = { - props: { - ...omit(this.$props, 'refresh'), - [childPropName]: this.fetchedData - }, - on: this.$listeners - } - return ( -
- {!this.error && !this.loading && } - - ) + ) + } else { + return ( +
+ {this.error + ? {this.$t('general.generic_error')} + : + } +
+ ) + } }, - props: [...props, 'refresh'], data () { return { loading: false, -- cgit v1.2.3-70-g09d2