Skip to content

Commit d76a3ee

Browse files
committed
Merge branch 'master' into feature/react-hook-form
2 parents eb407bd + 424f400 commit d76a3ee

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/components/UserForm/index.jsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@ import errorMessage from '../ErrorMessage';
1616

1717
import './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

Comments
 (0)