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' ;
2
2
import { Text } from '@deriv/ui' ;
3
3
import { useForm } from 'react-hook-form' ;
4
4
import { isNotDemoCurrency } from '@site/src/utils' ;
@@ -33,6 +33,7 @@ const AppForm = ({
33
33
register,
34
34
handleSubmit,
35
35
formState : { errors } ,
36
+ reset,
36
37
} = useForm < IRegisterAppForm > ( {
37
38
mode : 'onBlur' ,
38
39
resolver : yupResolver ( is_update_mode ? appEditSchema : appRegisterSchema ) ,
@@ -53,6 +54,11 @@ const AppForm = ({
53
54
return admin_check_array . includes ( true ) ;
54
55
} ;
55
56
57
+ const submitAndReset = ( e ) => {
58
+ submit ( e ) ;
59
+ reset ( ) ;
60
+ } ;
61
+
56
62
const disableMarkup = useMemo ( ( ) => {
57
63
let isDisabled ;
58
64
isNotDemoCurrency ( currentLoginAccount ) === 'Demo' ? ( isDisabled = true ) : ( isDisabled = false ) ;
@@ -71,7 +77,7 @@ const AppForm = ({
71
77
72
78
return (
73
79
< React . Fragment >
74
- < form role = { 'form' } className = { styles . apps_form } onSubmit = { handleSubmit ( submit ) } >
80
+ < form role = { 'form' } className = { styles . apps_form } onSubmit = { handleSubmit ( submitAndReset ) } >
75
81
< div
76
82
className = { `${ styles . formContent } ${
77
83
! admin_token && ! is_update_mode ? styles . noAdmin : ''
You can’t perform that action at this time.
0 commit comments