From 92184cad5d46a470c8a828c8945e31a0e7662fab Mon Sep 17 00:00:00 2001 From: samau3 Date: Sun, 20 Oct 2024 00:34:53 -0700 Subject: [PATCH] Rename variables to be more descriptive --- .../inputs/HealthcareChoicesSearch.jsx | 4 +-- .../register/inputs/RegisterPhysician.jsx | 26 +++++++++++-------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/client/src/pages/patients/register/inputs/HealthcareChoicesSearch.jsx b/client/src/pages/patients/register/inputs/HealthcareChoicesSearch.jsx index 9d93e2a5..0b789d9e 100644 --- a/client/src/pages/patients/register/inputs/HealthcareChoicesSearch.jsx +++ b/client/src/pages/patients/register/inputs/HealthcareChoicesSearch.jsx @@ -146,8 +146,8 @@ export default function HealthcareChoicesSearch({ form, choice, initialData }) { {choice === 'physician' && ( )} diff --git a/client/src/pages/patients/register/inputs/RegisterPhysician.jsx b/client/src/pages/patients/register/inputs/RegisterPhysician.jsx index 7d0aaea8..35f894f2 100644 --- a/client/src/pages/patients/register/inputs/RegisterPhysician.jsx +++ b/client/src/pages/patients/register/inputs/RegisterPhysician.jsx @@ -18,8 +18,8 @@ import { StatusCodes } from 'http-status-codes'; const registerPhysicianProps = { setPhysician: PropTypes.func.isRequired, - opened: PropTypes.bool.isRequired, - close: PropTypes.func.isRequired, + registerPhysicianOpened: PropTypes.bool.isRequired, + closeRegisterPhysician: PropTypes.func.isRequired, fetchOptions: PropTypes.func.isRequired, }; @@ -29,8 +29,8 @@ const registerPhysicianProps = { */ export default function RegisterPhysician({ setPhysician, - opened, - close, + registerPhysicianOpened, + closeRegisterPhysician, fetchOptions, }) { const [ @@ -62,7 +62,11 @@ export default function RegisterPhysician({ }, }); - const { error, reset, mutateAsync } = useMutation({ + const { + error, + reset: mutationReset, + mutateAsync, + } = useMutation({ mutationKey: ['physician'], mutationFn: async (data) => { const res = await LifelineAPI.registerPhysician(data); @@ -81,10 +85,10 @@ export default function RegisterPhysician({ const { firstName, middleName, lastName } = result; const fullName = `${firstName}${middleName ? ' ' + middleName + ' ' : ' '}${lastName}`; setPhysician(result.id, fullName); - form.reset(); - reset(); - close(); fetchOptions(fullName); + form.reset(); + mutationReset(); + closeRegisterPhysician(); } catch (error) { console.error(error.message); } @@ -94,19 +98,19 @@ export default function RegisterPhysician({ if (form.isDirty() && confirmed) { closeConfirmationModal(); form.reset(); - reset(); + mutationReset(); } if (form.isDirty()) { openConfirmationModal(); } else { - close(); + closeRegisterPhysician(); } }; return ( <>