This repository was archived by the owner on May 13, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
src/features/dashboard/components/AppForm Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 1- import React , { ReactNode , useMemo } from 'react' ;
1+ import React , { ReactNode , useCallback , useMemo } from 'react' ;
22import { Text } from '@deriv/ui' ;
33import { useForm } from 'react-hook-form' ;
44import { isNotDemoCurrency } from '@site/src/utils' ;
@@ -33,6 +33,7 @@ const AppForm = ({
3333 register,
3434 handleSubmit,
3535 formState : { errors } ,
36+ reset,
3637 } = useForm < IRegisterAppForm > ( {
3738 mode : 'onBlur' ,
3839 resolver : yupResolver ( is_update_mode ? appEditSchema : appRegisterSchema ) ,
@@ -53,6 +54,11 @@ const AppForm = ({
5354 return admin_check_array . includes ( true ) ;
5455 } ;
5556
57+ const submitAndReset = ( e ) => {
58+ submit ( e ) ;
59+ reset ( ) ;
60+ } ;
61+
5662 const disableMarkup = useMemo ( ( ) => {
5763 let isDisabled ;
5864 isNotDemoCurrency ( currentLoginAccount ) === 'Demo' ? ( isDisabled = true ) : ( isDisabled = false ) ;
@@ -71,7 +77,7 @@ const AppForm = ({
7177
7278 return (
7379 < React . Fragment >
74- < form role = { 'form' } className = { styles . apps_form } onSubmit = { handleSubmit ( submit ) } >
80+ < form role = { 'form' } className = { styles . apps_form } onSubmit = { handleSubmit ( submitAndReset ) } >
7581 < div
7682 className = { `${ styles . formContent } ${
7783 ! admin_token && ! is_update_mode ? styles . noAdmin : ''
You can’t perform that action at this time.
0 commit comments