Skip to content

Commit

Permalink
[2.x] Inertia - ensure file selection is not empty before updating pr…
Browse files Browse the repository at this point in the history
…ofile photo preview (#782)

* Update UpdateProfileInformationForm.vue

* Update UpdateProfileInformationForm.vue

Co-authored-by: Taylor Otwell <[email protected]>
  • Loading branch information
nkutinha and taylorotwell authored May 12, 2021
1 parent 53b107c commit 86b5d32
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,17 @@
},
updatePhotoPreview() {
const photo = this.$refs.photo.files[0];
if (! photo) return;
const reader = new FileReader();
reader.onload = (e) => {
this.photoPreview = e.target.result;
};
reader.readAsDataURL(this.$refs.photo.files[0]);
reader.readAsDataURL(photo);
},
deletePhoto() {
Expand Down

0 comments on commit 86b5d32

Please sign in to comment.