aboutsummaryrefslogtreecommitdiff
path: root/src/components/user_avatar/user_avatar.js
blob: bfa2c2b5c4ca7684d6cce04b2bee31bff4e48ced (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
import StillImage from '../still-image/still-image.vue'
import nsfwImage from '../../assets/nsfw.png'

const UserAvatar = {
  props: [
    'src'
  ],
  data () {
    return {
      showPlaceholder: false
    }
  },
  components: {
    StillImage
  },
  computed: {
    imgSrc () {
      return this.showPlaceholder ? nsfwImage : this.src
    }
  },
  methods: {
    imageLoadError () {
      this.showPlaceholder = true
    }
  }
}

export default UserAvatar