Move instances of Client.resetPassword() in components to an action (#5167)

This commit is contained in:
Carlos Tadeu Panato Junior
2017-01-24 10:23:09 +01:00
committed by George Goldberg
parent 1e5354cff3
commit b87cd4e276
2 changed files with 25 additions and 4 deletions

View File

@@ -2,12 +2,12 @@
// See License.txt for license information.
import ReactDOM from 'react-dom';
import Client from 'client/web_client.jsx';
import * as Utils from 'utils/utils.jsx';
import Constants from 'utils/constants.jsx';
import {FormattedMessage} from 'react-intl';
import {browserHistory} from 'react-router/es6';
import {resetPassword} from 'actions/user_actions.jsx';
import React from 'react';
@@ -42,12 +42,11 @@ class PasswordResetForm extends React.Component {
error: null
});
Client.resetPassword(
resetPassword(
this.props.location.query.code,
password,
() => {
this.setState({error: null});
browserHistory.push('/login?extra=' + Constants.PASSWORD_CHANGE);
},
(err) => {
this.setState({error: err.message});