aboutsummaryrefslogtreecommitdiff
path: root/src/components/mute_card/mute_card.js
blob: cbec0e9bb38dcab253e5ab5c2cd6722d44e8ad1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import BasicUserCard from '../basic_user_card/basic_user_card.vue'

const MuteCard = {
  props: ['userId'],
  data () {
    return {
      progress: false
    }
  },
  computed: {
    user () {
      return this.$store.getters.findUser(this.userId)
    },
    relationship () {
      return this.$store.getters.relationship(this.userId)
    },
    muted () {
      return this.relationship.muting
    }
  },
  components: {
    BasicUserCard
  },
  methods: {
    unmuteUser () {
      this.progress = true
      this.$store.dispatch('unmuteUser', this.userId).then(() => {
        this.progress = false
      })
    },
    muteUser () {
      this.progress = true
      this.$store.dispatch('muteUser', this.userId).then(() => {
        this.progress = false
      })
    }
  }
}

export default MuteCard