From c34618e860a8c9d8d0c5fde83da0a3ae8c50c9f4 Mon Sep 17 00:00:00 2001 From: samau3 Date: Sat, 19 Oct 2024 23:52:14 -0700 Subject: [PATCH] Reset form values and mutation when confirmed closing --- .../pages/patients/register/inputs/RegisterPhysician.jsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/client/src/pages/patients/register/inputs/RegisterPhysician.jsx b/client/src/pages/patients/register/inputs/RegisterPhysician.jsx index 39b0cc1e..4c153c22 100644 --- a/client/src/pages/patients/register/inputs/RegisterPhysician.jsx +++ b/client/src/pages/patients/register/inputs/RegisterPhysician.jsx @@ -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); @@ -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(); @@ -101,6 +102,8 @@ export default function RegisterPhysician({ } }; + console.log(form.getValues()); + return ( <>