@ -28,7 +28,6 @@ interface IProps {
@@ -28,7 +28,6 @@ interface IProps {
export const FormUser : FC < IProps > = ( {
profile ,
authProfileId ,
factory ,
onSuccessUpdate ,
onError ,
} ) = > {
@ -45,9 +44,9 @@ export const FormUser: FC<IProps> = ({
@@ -45,9 +44,9 @@ export const FormUser: FC<IProps> = ({
validateEmail ,
isErrorModal ,
isDisableBtns ,
sendPasswordToEmail ,
getValues ,
setError ,
setValue ,
} = useProfileForm ( {
profile ,
authId : authProfileId ,
@ -59,6 +58,16 @@ export const FormUser: FC<IProps> = ({
@@ -59,6 +58,16 @@ export const FormUser: FC<IProps> = ({
return moment ( ) . add ( 0 , "days" ) <= current ;
} ;
const submitAndSendPassword = ( sendTo : "email" | "sms" ) = > {
setValue ( "sendPasswordBy" , sendTo ) ;
onSubmit ( ) ;
} ;
const submitChanges = ( ) = > {
setValue ( "sendPasswordBy" , null ) ;
onSubmit ( ) ;
} ;
return (
< >
< Modal show = { isErrorModal . isShow } title = { "Профіль не збережено" } >
@ -70,7 +79,7 @@ export const FormUser: FC<IProps> = ({
@@ -70,7 +79,7 @@ export const FormUser: FC<IProps> = ({
< ModalValidationUserName submitChageAccount = { submitChageAccount } / >
< form
className = "form"
onSubmit = { onSubmit }
onSubmit = { submitChanges }
style = { { flexDirection : "column" } }
>
< div style = { { display : "flex" , flexDirection : "row" , width : "100%" } } >
@ -358,9 +367,8 @@ export const FormUser: FC<IProps> = ({
@@ -358,9 +367,8 @@ export const FormUser: FC<IProps> = ({
< div style = { { paddingLeft : 0 , marginTop : 30 , display : "flex" } } >
< Button
onClick = { onSubmit }
onClick = { submitChanges }
color = "primary"
type = "submit"
className = "btn save-profile__btn"
>
З б е р е г т и
@ -371,10 +379,7 @@ export const FormUser: FC<IProps> = ({
@@ -371,10 +379,7 @@ export const FormUser: FC<IProps> = ({
color = "primary"
type = "button"
disabled = { isDisableBtns }
onClick = { ( ) = > {
sendPasswordToEmail ( true ) ;
onSubmit ( ) ;
} }
onClick = { ( ) = > submitAndSendPassword ( "email" ) }
>
З б е р е г т и { " " }
< i style = { { marginLeft : 10 } } className = "fal fa-envelope" / >
@ -385,10 +390,7 @@ export const FormUser: FC<IProps> = ({
@@ -385,10 +390,7 @@ export const FormUser: FC<IProps> = ({
color = "primary"
type = "button"
disabled = { isDisableBtns }
onClick = { ( ) = > {
sendPasswordToEmail ( false ) ;
onSubmit ( ) ;
} }
onClick = { ( ) = > submitAndSendPassword ( "sms" ) }
>
З б е р е г т и < i style = { { marginLeft : 10 } } className = "fal fa-sms" / >
< / Button >