Skip to content

Commit

Permalink
Reset form values and mutation when confirmed closing
Browse files Browse the repository at this point in the history
  • Loading branch information
samau3 committed Oct 20, 2024
1 parent 20603b2 commit c34618e
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export default function RegisterPhysician({
},
});

const { error, mutateAsync } = useMutation({
const { error, reset, mutateAsync } = useMutation({
mutationKey: ['physician'],
mutationFn: async (data) => {
const res = await LifelineAPI.registerPhysician(data);
Expand Down Expand Up @@ -92,7 +92,8 @@ export default function RegisterPhysician({
const confirmClose = (confirmed) => {
if (form.isDirty() && confirmed) {
closeConfirmationModal();
form.resetDirty();
form.reset();
reset();
}
if (form.isDirty()) {
openConfirmationModal();
Expand All @@ -101,6 +102,8 @@ export default function RegisterPhysician({
}
};

console.log(form.getValues());

return (
<>
<Modal
Expand Down

0 comments on commit c34618e

Please sign in to comment.