diff --git a/src/components/profile/ProfileSettings/index.tsx b/src/components/profile/ProfileSettings/index.tsx index 7a29ab30..c140d4ef 100644 --- a/src/components/profile/ProfileSettings/index.tsx +++ b/src/components/profile/ProfileSettings/index.tsx @@ -19,7 +19,8 @@ const mapStateToProps = state => ({ }); const mapDispatchToProps = { - authPatchUser: AUTH_ACTIONS.authPatchUser + authPatchUser: AUTH_ACTIONS.authPatchUser, + authSetProfile: AUTH_ACTIONS.authSetProfile }; type IProps = ReturnType & @@ -27,8 +28,9 @@ type IProps = ReturnType & const ProfileSettingsUnconnected: FC = ({ user, + profile: { patch_errors }, authPatchUser, - profile: { patch_errors } + authSetProfile }) => { const [password, setPassword] = useState(""); const [new_password, setNewPassword] = useState(""); @@ -44,6 +46,7 @@ const ProfileSettingsUnconnected: FC = ({ data, setData ]); + const setUsername = useCallback(username => setData({ ...data, username }), [ data, setData @@ -68,6 +71,10 @@ const ProfileSettingsUnconnected: FC = ({ [data, password, new_password, authPatchUser] ); + useEffect(() => { + authSetProfile({ patch_errors: {} }); + }, [password, new_password, data]); + return (