aboutsummaryrefslogtreecommitdiff
path: root/src/components/user_avatar/user_avatar.js
blob: 4adf82113ca22af3b355906c97fa03b1403e1eac (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
import StillImage from '../still-image/still-image.vue'

const UserAvatar = {
  props: [
    'user',
    'betterShadow',
    'compact'
  ],
  data () {
    return {
      showPlaceholder: false
    }
  },
  components: {
    StillImage
  },
  computed: {
    imgSrc () {
      return this.showPlaceholder ? '/images/avi.png' : this.user.profile_image_url_original
    }
  },
  methods: {
    imageLoadError () {
      this.showPlaceholder = true
    }
  },
  watch: {
    src () {
      this.showPlaceholder = false
    }
  }
}

export default UserAvatar