#349: fix improperly bond action creator (sentry #5527)

This commit is contained in:
SleepWalker 2017-08-09 21:01:32 +03:00
parent c306b07a7a
commit 0a5f2d1e95

View File

@ -1,9 +1,11 @@
import React, { Component, PropTypes } from 'react'; // @flow
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { Route, Switch, Redirect } from 'react-router-dom'; import { Route, Switch, Redirect } from 'react-router-dom';
import logger from 'services/logger'; import logger from 'services/logger';
import { browserHistory } from 'services/history';
import Profile from 'components/profile/Profile'; import Profile from 'components/profile/Profile';
import ChangePasswordPage from 'pages/profile/ChangePasswordPage'; import ChangePasswordPage from 'pages/profile/ChangePasswordPage';
import ChangeUsernamePage from 'pages/profile/ChangeUsernamePage'; import ChangeUsernamePage from 'pages/profile/ChangeUsernamePage';
@ -13,14 +15,12 @@ import { FooterMenu } from 'components/footerMenu';
import styles from './profile.scss'; import styles from './profile.scss';
class ProfilePage extends Component { import type { FormModel } from 'components/ui/form';
displayName = 'ProfilePage';
static propTypes = { class ProfilePage extends Component {
onSubmit: PropTypes.func.isRequired, props: {
fetchUserData: PropTypes.func.isRequired, onSubmit: ({form: FormModel, sendData: () => Promise<*>}) => void,
goToProfile: PropTypes.func.isRequired, fetchUserData: () => Promise<*>
children: PropTypes.element
}; };
static childContextTypes = { static childContextTypes = {
@ -31,7 +31,7 @@ class ProfilePage extends Component {
getChildContext() { getChildContext() {
return { return {
onSubmit: this.props.onSubmit, onSubmit: this.props.onSubmit,
goToProfile: () => this.props.fetchUserData().then(this.props.goToProfile) goToProfile: () => this.props.fetchUserData().then(this.goToProfile)
}; };
} }
@ -53,18 +53,16 @@ class ProfilePage extends Component {
</div> </div>
); );
} }
goToProfile = () => browserHistory.push('/');
} }
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { browserHistory } from 'services/history';
import { fetchUserData } from 'components/user/actions'; import { fetchUserData } from 'components/user/actions';
import { create as createPopup } from 'components/ui/popup/actions'; import { create as createPopup } from 'components/ui/popup/actions';
import PasswordRequestForm from 'components/profile/passwordRequestForm/PasswordRequestForm'; import PasswordRequestForm from 'components/profile/passwordRequestForm/PasswordRequestForm';
export default connect(null, { export default connect(null, {
goToProfile() {
return browserHistory.push('/');
},
fetchUserData, fetchUserData,
onSubmit: ({form, sendData}) => (dispatch) => { onSubmit: ({form, sendData}) => (dispatch) => {
form.beginLoading(); form.beginLoading();