From f727b25d2f52e25b3f562b355a9b695f376133c5 Mon Sep 17 00:00:00 2001 From: Radoslaw Szwajkowski Date: Thu, 21 Mar 2024 18:24:22 +0100 Subject: [PATCH] Simplify onSubmit handler Signed-off-by: Radoslaw Szwajkowski --- .../components/application-form/application-form-modal.tsx | 2 +- .../components/application-form/application-form.tsx | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/client/src/app/pages/applications/components/application-form/application-form-modal.tsx b/client/src/app/pages/applications/components/application-form/application-form-modal.tsx index 89cfe65de8..f92ed41632 100644 --- a/client/src/app/pages/applications/components/application-form/application-form-modal.tsx +++ b/client/src/app/pages/applications/components/application-form/application-form-modal.tsx @@ -32,7 +32,7 @@ export const ApplicationFormModal: React.FC = ({ aria-label="submit" variant={ButtonVariant.primary} isDisabled={formProps.isSubmitDisabled} - onClick={formProps.onSubmit()} + onClick={formProps.onSubmit} > {!application ? t("actions.create") : t("actions.save")} , diff --git a/client/src/app/pages/applications/components/application-form/application-form.tsx b/client/src/app/pages/applications/components/application-form/application-form.tsx index 35a63c564a..e3568cf6eb 100644 --- a/client/src/app/pages/applications/components/application-form/application-form.tsx +++ b/client/src/app/pages/applications/components/application-form/application-form.tsx @@ -330,14 +330,13 @@ export const useApplicationFormHook = ({ isCancelDisabled: isSubmitting || isValidating, stakeholders, businessServiceOptions, - onSubmit: () => handleSubmit(onValidSubmit), + onSubmit: handleSubmit(onValidSubmit), }; }; export const ApplicationForm: React.FC< ReturnType > = ({ - onSubmit, setBasicExpanded, isBasicExpanded, control, @@ -353,7 +352,7 @@ export const ApplicationForm: React.FC< }) => { const { t } = useTranslation(); return ( -
+