From 0544b8358af68df87dbc472221d8c0842c2b2db0 Mon Sep 17 00:00:00 2001
From: Sebastian <sebasjm@gmail.com>
Date: Fri, 19 May 2023 13:26:47 -0300
Subject: accounts and notifications

---
 .../exchange-backoffice-ui/src/handlers/FormProvider.tsx     | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

(limited to 'packages/exchange-backoffice-ui/src/handlers/FormProvider.tsx')

diff --git a/packages/exchange-backoffice-ui/src/handlers/FormProvider.tsx b/packages/exchange-backoffice-ui/src/handlers/FormProvider.tsx
index d8877333c..87c4c43fb 100644
--- a/packages/exchange-backoffice-ui/src/handlers/FormProvider.tsx
+++ b/packages/exchange-backoffice-ui/src/handlers/FormProvider.tsx
@@ -41,10 +41,12 @@ export function FormProvider<T>({
   children,
   initialValue,
   onUpdate,
+  onSubmit,
   computeFormState,
 }: {
   initialValue?: Partial<T>;
   onUpdate?: (v: Partial<T>) => void;
+  onSubmit: (v: T) => void;
   computeFormState?: (v: T) => FormState<T>;
   children: ComponentChildren;
 }): VNode {
@@ -58,7 +60,15 @@ export function FormProvider<T>({
     <FormContext.Provider
       value={{ initialValue, value, onUpdate, computeFormState }}
     >
-      <form>{children}</form>
+      <form
+        onSubmit={(e) => {
+          e.preventDefault();
+          //@ts-ignore
+          onSubmit(value.current);
+        }}
+      >
+        {children}
+      </form>
     </FormContext.Provider>
   );
 }
-- 
cgit v1.2.3

