aboutsummaryrefslogtreecommitdiff
path: root/src/components/block_card/block_card.js
blob: 0bf4e37bc0906cb35a20d3c30399510dee2eec8a (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 BlockCard = {
  props: ['userId'],
  data () {
    return {
      progress: false
    }
  },
  computed: {
    user () {
      return this.$store.getters.findUser(this.userId)
    },
    relationship () {
      return this.$store.getters.relationship(this.userId)
    },
    blocked () {
      return this.relationship.blocking
    }
  },
  components: {
    BasicUserCard
  },
  methods: {
    unblockUser () {
      this.progress = true
      this.$store.dispatch('unblockUser', this.user.id).then(() => {
        this.progress = false
      })
    },
    blockUser () {
      this.progress = true
      this.$store.dispatch('blockUser', this.user.id).then(() => {
        this.progress = false
      })
    }
  }
}

export default BlockCard