Skip to content

Commit 181273c

Browse files
authored
[2.x] Inertia - clear user profile photo input (#781)
* Update UpdateProfileInformationForm.vue UpdateProfileInformationForm.vue: - clear photo file input value * Update UpdateProfileInformationForm.vue missing comma
1 parent 244150f commit 181273c

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

Diff for: stubs/inertia/resources/js/Pages/Profile/UpdateProfileInformationForm.vue

+12-2
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@
111111
112112
this.form.post(route('user-profile-information.update'), {
113113
errorBag: 'updateProfileInformation',
114-
preserveScroll: true
114+
preserveScroll: true,
115+
onSuccess: () => (this.clearPhotoFileInput()),
115116
});
116117
},
117118
@@ -132,9 +133,18 @@
132133
deletePhoto() {
133134
this.$inertia.delete(route('current-user-photo.destroy'), {
134135
preserveScroll: true,
135-
onSuccess: () => (this.photoPreview = null),
136+
onSuccess: () => {
137+
this.photoPreview = null;
138+
this.clearPhotoFileInput();
139+
},
136140
});
137141
},
142+
143+
clearPhotoFileInput() {
144+
if (this.$refs.photo?.value) {
145+
this.$refs.photo.value = null;
146+
}
147+
},
138148
},
139149
}
140150
</script>

0 commit comments

Comments
 (0)