diff options
author | Jessica <jessica@Absolventas-MacBook-Pro.local> | 2018-09-28 16:45:35 +0200 |
---|---|---|
committer | Jessica <jessica@Absolventas-MacBook-Pro.local> | 2018-09-28 16:45:35 +0200 |
commit | 8b44718f94cc607165c23a97aca680b24461c121 (patch) | |
tree | 87b0549fae2408e87706c4fd76c4d6f21c7ce8d8 /src | |
parent | 5394404bc80e9216bc1013a8fb4bfb4a2498a5ac (diff) | |
parent | 52f8b882a62ef6819fba5a801dbd4f50bd191f50 (diff) |
Merge branch 'vue-avatar-management' of github.com:nextcloud/contacts into vue-avatar-management
Diffstat (limited to 'src')
-rw-r--r-- | src/components/ContactDetails/ContactDetailsAvatar.vue | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/components/ContactDetails/ContactDetailsAvatar.vue b/src/components/ContactDetails/ContactDetailsAvatar.vue index bc09b227..0a249d4a 100644 --- a/src/components/ContactDetails/ContactDetailsAvatar.vue +++ b/src/components/ContactDetails/ContactDetailsAvatar.vue @@ -56,18 +56,20 @@ export default { }, methods: { processFile(event) { - let file = event.target.files[0] - let reader = new FileReader() - let self = this - // check if photo property exists to decide whether to add/update it - reader.onload = function(e) { - self.contact.photo - ? self.contact.photo = reader.result - : self.contact.vCard.addPropertyWithValue('photo', reader.result) + if (event.target.files) { + let file = event.target.files[0] + let reader = new FileReader() + let self = this + // check if photo property exists to decide whether to add/update it + reader.onload = function(e) { + self.contact.photo + ? self.contact.photo = reader.result + : self.contact.vCard.addPropertyWithValue('photo', reader.result) - self.$store.dispatch('updateContact', self.contact) + self.$store.dispatch('updateContact', self.contact) + } + reader.readAsDataURL(file) } - reader.readAsDataURL(file) }, toggleSize() { // maximise or minimise avatar photo |