1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 04:46:40 +07:00

clearing initial data on settings

This commit is contained in:
Fedor Katurov 2019-11-14 15:11:25 +07:00
parent 93e7b05ddf
commit d8d7f6e035

View file

@ -19,7 +19,8 @@ const mapStateToProps = state => ({
});
const mapDispatchToProps = {
authPatchUser: AUTH_ACTIONS.authPatchUser
authPatchUser: AUTH_ACTIONS.authPatchUser,
authSetProfile: AUTH_ACTIONS.authSetProfile
};
type IProps = ReturnType<typeof mapStateToProps> &
@ -27,8 +28,9 @@ type IProps = ReturnType<typeof mapStateToProps> &
const ProfileSettingsUnconnected: FC<IProps> = ({
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<IProps> = ({
data,
setData
]);
const setUsername = useCallback(username => setData({ ...data, username }), [
data,
setData
@ -68,6 +71,10 @@ const ProfileSettingsUnconnected: FC<IProps> = ({
[data, password, new_password, authPatchUser]
);
useEffect(() => {
authSetProfile({ patch_errors: {} });
}, [password, new_password, data]);
return (
<form className={styles.wrap} onSubmit={onSubmit}>
<Group>