diff options
| author | Henry Jameson <me@hjkos.com> | 2019-09-29 22:33:15 +0300 |
|---|---|---|
| committer | Henry Jameson <me@hjkos.com> | 2019-09-29 22:33:15 +0300 |
| commit | 979e170bd6880d0ee85bf0dd8898cf53d91055b5 (patch) | |
| tree | 27e080d1ecc85cfeaa2a23cdc16b8b10994cce8f /src/components/favorite_button | |
| parent | aadd36f3ec2d5131deae43a4e8042455a90ca16f (diff) | |
created mergedConfig getter to avoid obnoxious checks for undefined everywhere
Diffstat (limited to 'src/components/favorite_button')
| -rw-r--r-- | src/components/favorite_button/favorite_button.js | 8 | ||||
| -rw-r--r-- | src/components/favorite_button/favorite_button.vue | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/components/favorite_button/favorite_button.js b/src/components/favorite_button/favorite_button.js index a24eacbf..5014d84f 100644 --- a/src/components/favorite_button/favorite_button.js +++ b/src/components/favorite_button/favorite_button.js @@ -1,10 +1,9 @@ +import { mapGetters } from 'vuex' + const FavoriteButton = { props: ['status', 'loggedIn'], data () { return { - hidePostStatsLocal: typeof this.$store.state.config.hidePostStats === 'undefined' - ? this.$store.state.instance.hidePostStats - : this.$store.state.config.hidePostStats, animated: false } }, @@ -28,7 +27,8 @@ const FavoriteButton = { 'icon-star': this.status.favorited, 'animate-spin': this.animated } - } + }, + ...mapGetters(['mergedConfig']) } } diff --git a/src/components/favorite_button/favorite_button.vue b/src/components/favorite_button/favorite_button.vue index 06ce9983..fbc90f84 100644 --- a/src/components/favorite_button/favorite_button.vue +++ b/src/components/favorite_button/favorite_button.vue @@ -6,7 +6,7 @@ :title="$t('tool_tip.favorite')" @click.prevent="favorite()" /> - <span v-if="!hidePostStatsLocal && status.fave_num > 0">{{ status.fave_num }}</span> + <span v-if="!mergedConfig.hidePostStats && status.fave_num > 0">{{ status.fave_num }}</span> </div> <div v-else> <i @@ -14,7 +14,7 @@ class="button-icon favorite-button" :title="$t('tool_tip.favorite')" /> - <span v-if="!hidePostStatsLocal && status.fave_num > 0">{{ status.fave_num }}</span> + <span v-if="!mergedConfig.hidePostStats && status.fave_num > 0">{{ status.fave_num }}</span> </div> </template> |
