Skip to content

Commit 86b5d32

Browse files
[2.x] Inertia - ensure file selection is not empty before updating profile photo preview (#782)
* Update UpdateProfileInformationForm.vue * Update UpdateProfileInformationForm.vue Co-authored-by: Taylor Otwell <[email protected]>
1 parent 53b107c commit 86b5d32

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

stubs/inertia/resources/js/Pages/Profile/UpdateProfileInformationForm.vue

+5-1
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,17 @@
121121
},
122122
123123
updatePhotoPreview() {
124+
const photo = this.$refs.photo.files[0];
125+
126+
if (! photo) return;
127+
124128
const reader = new FileReader();
125129
126130
reader.onload = (e) => {
127131
this.photoPreview = e.target.result;
128132
};
129133
130-
reader.readAsDataURL(this.$refs.photo.files[0]);
134+
reader.readAsDataURL(photo);
131135
},
132136
133137
deletePhoto() {

0 commit comments

Comments
 (0)