aboutsummaryrefslogtreecommitdiff
path: root/src/components/favorite_button
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/favorite_button')
-rw-r--r--src/components/favorite_button/favorite_button.js12
-rw-r--r--src/components/favorite_button/favorite_button.vue17
2 files changed, 19 insertions, 10 deletions
diff --git a/src/components/favorite_button/favorite_button.js b/src/components/favorite_button/favorite_button.js
index a2b4cb65..5014d84f 100644
--- a/src/components/favorite_button/favorite_button.js
+++ b/src/components/favorite_button/favorite_button.js
@@ -1,19 +1,18 @@
+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
}
},
methods: {
favorite () {
if (!this.status.favorited) {
- this.$store.dispatch('favorite', {id: this.status.id})
+ this.$store.dispatch('favorite', { id: this.status.id })
} else {
- this.$store.dispatch('unfavorite', {id: this.status.id})
+ this.$store.dispatch('unfavorite', { id: this.status.id })
}
this.animated = true
setTimeout(() => {
@@ -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 05ce6bd0..fbc90f84 100644
--- a/src/components/favorite_button/favorite_button.vue
+++ b/src/components/favorite_button/favorite_button.vue
@@ -1,11 +1,20 @@
<template>
<div v-if="loggedIn">
- <i :class='classes' class='button-icon favorite-button fav-active' @click.prevent='favorite()' :title="$t('tool_tip.favorite')"/>
- <span v-if='!hidePostStatsLocal && status.fave_num > 0'>{{status.fave_num}}</span>
+ <i
+ :class="classes"
+ class="button-icon favorite-button fav-active"
+ :title="$t('tool_tip.favorite')"
+ @click.prevent="favorite()"
+ />
+ <span v-if="!mergedConfig.hidePostStats && status.fave_num > 0">{{ status.fave_num }}</span>
</div>
<div v-else>
- <i :class='classes' class='button-icon favorite-button' :title="$t('tool_tip.favorite')"/>
- <span v-if='!hidePostStatsLocal && status.fave_num > 0'>{{status.fave_num}}</span>
+ <i
+ :class="classes"
+ class="button-icon favorite-button"
+ :title="$t('tool_tip.favorite')"
+ />
+ <span v-if="!mergedConfig.hidePostStats && status.fave_num > 0">{{ status.fave_num }}</span>
</div>
</template>