2019-02-13 11:55:02 -08:00
|
|
|
import BasicUserCard from '../basic_user_card/basic_user_card.vue'
|
|
|
|
|
|
|
|
const BlockCard = {
|
2019-02-13 12:31:20 -08:00
|
|
|
props: ['userId'],
|
2019-02-13 11:55:02 -08:00
|
|
|
data () {
|
|
|
|
return {
|
2019-02-13 12:31:20 -08:00
|
|
|
progress: false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
user () {
|
2019-03-08 12:40:57 -08:00
|
|
|
return this.$store.getters.findUser(this.userId)
|
2019-02-13 12:31:20 -08:00
|
|
|
},
|
2020-04-21 13:27:51 -07:00
|
|
|
relationship () {
|
|
|
|
return this.$store.state.users.relationships[this.userId] || {}
|
|
|
|
},
|
2019-02-13 12:31:20 -08:00
|
|
|
blocked () {
|
2020-04-21 13:27:51 -07:00
|
|
|
return this.relationship.blocking
|
2019-02-13 11:55:02 -08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
components: {
|
|
|
|
BasicUserCard
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
unblockUser () {
|
|
|
|
this.progress = true
|
2019-02-13 12:31:20 -08:00
|
|
|
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
|
|
|
|
})
|
2019-02-13 11:55:02 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default BlockCard
|