@@ -16,10 +16,11 @@ import errorMessage from '../ErrorMessage';
1616
1717import './UserForm.scss' ;
1818
19- const UserForm = ( { isEditing, isProfile, user, action } ) => {
20- const { loading } = useSelector (
19+ const UserForm = ( { isEditing, isProfile, user, setUser , action } ) => {
20+ const { loading, success } = useSelector (
2121 ( state ) => ( {
2222 loading : state . users . loading ,
23+ success : state . users . success ,
2324 } ) ,
2425 shallowEqual
2526 ) ;
@@ -42,8 +43,11 @@ const UserForm = ({ isEditing, isProfile, user, action }) => {
4243 } ) ;
4344
4445 useEffect ( ( ) => {
46+ if ( success ) {
47+ setUser ( ( prevState ) => ( { ...prevState , file : null } ) ) ;
48+ }
4549 return ( ) => dispatch ( usersCleanUp ( ) ) ;
46- } , [ dispatch ] ) ;
50+ } , [ dispatch , success ] ) ;
4751
4852 const onSubmitHandler = ( value ) => {
4953 const newUser = {
@@ -250,7 +254,7 @@ const UserForm = ({ isEditing, isProfile, user, action }) => {
250254 />
251255 < span className = "file-cta" >
252256 < span className = "file-icon" >
253- < i className = "fas fa -upload" />
257+ < i className = "mdi mdi -upload" />
254258 </ span >
255259 < span className = "file-label" >
256260 { watch ( 'file' ) && watch ( 'file' ) . file
0 commit comments