Skip to content

Commit

Permalink
fix: add clearErrors on DeleteUserForm on closeModal function (#406)
Browse files Browse the repository at this point in the history
* fix: add clearErrors on DeleteUserForm on closeModal

Closing delete user modal with validation errors it will reset the input but not reset the validation errors.
Adding clearErrors on closeModal function will resolve this issue.

* Update DeleteUserForm.tsx

* Update DeleteUserForm.jsx

* Update DeleteUserForm.vue

* Update DeleteUserForm.vue

---------

Co-authored-by: Taylor Otwell <taylor@laravel.com>
  • Loading branch information
radumargina and taylorotwell authored Sep 9, 2024
1 parent 2785c74 commit 666ea22
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export default function DeleteUserForm({ className = '' }: { className?: string
processing,
reset,
errors,
clearErrors,
} = useForm({
password: '',
});
Expand All @@ -40,6 +41,7 @@ export default function DeleteUserForm({ className = '' }: { className?: string
const closeModal = () => {
setConfirmingUserDeletion(false);

clearErrors();
reset();
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export default function DeleteUserForm({ className = '' }) {
processing,
reset,
errors,
clearErrors,
} = useForm({
password: '',
});
Expand All @@ -40,6 +41,7 @@ export default function DeleteUserForm({ className = '' }) {
const closeModal = () => {
setConfirmingUserDeletion(false);

clearErrors();
reset();
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const deleteUser = () => {
const closeModal = () => {
confirmingUserDeletion.value = false;
form.clearErrors();
form.reset();
};
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const deleteUser = () => {
const closeModal = () => {
confirmingUserDeletion.value = false;
form.clearErrors();
form.reset();
};
</script>
Expand Down

0 comments on commit 666ea22

Please sign in to comment.