Move instances of Client.verifyEmail() in components to an action (#5166)
Этот коммит содержится в:
коммит произвёл
George Goldberg
родитель
58b3c76c94
Коммит
1e5354cff3
@@ -561,3 +561,20 @@ export function updatePassword(userId, currentPassword, newPassword, success, er
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function verifyEmail(uid, hid, success, error) {
|
||||||
|
Client.verifyEmail(
|
||||||
|
uid,
|
||||||
|
hid,
|
||||||
|
(data) => {
|
||||||
|
if (success) {
|
||||||
|
success(data);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
(err) => {
|
||||||
|
if (error) {
|
||||||
|
error(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,11 +2,12 @@
|
|||||||
// See License.txt for license information.
|
// See License.txt for license information.
|
||||||
|
|
||||||
import {FormattedMessage} from 'react-intl';
|
import {FormattedMessage} from 'react-intl';
|
||||||
import Client from 'client/web_client.jsx';
|
|
||||||
import LoadingScreen from './loading_screen.jsx';
|
import LoadingScreen from './loading_screen.jsx';
|
||||||
|
|
||||||
import {browserHistory, Link} from 'react-router/es6';
|
import {browserHistory, Link} from 'react-router/es6';
|
||||||
|
|
||||||
|
import {verifyEmail} from 'actions/user_actions.jsx';
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
export default class DoVerifyEmail extends React.Component {
|
export default class DoVerifyEmail extends React.Component {
|
||||||
@@ -19,15 +20,11 @@ export default class DoVerifyEmail extends React.Component {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
componentWillMount() {
|
componentWillMount() {
|
||||||
const uid = this.props.location.query.uid;
|
verifyEmail(
|
||||||
const hid = this.props.location.query.hid;
|
this.props.location.query.uid,
|
||||||
const email = this.props.location.query.email;
|
this.props.location.query.hid,
|
||||||
|
|
||||||
Client.verifyEmail(
|
|
||||||
uid,
|
|
||||||
hid,
|
|
||||||
() => {
|
() => {
|
||||||
browserHistory.push('/login?extra=verified&email=' + email);
|
browserHistory.push('/login?extra=verified&email=' + this.props.location.query.email);
|
||||||
},
|
},
|
||||||
(err) => {
|
(err) => {
|
||||||
this.setState({verifyStatus: 'failure', serverError: err.message});
|
this.setState({verifyStatus: 'failure', serverError: err.message});
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user