From 0a5f2d1e95fac3ab9afc49ec7e21dd9d0b10a35c Mon Sep 17 00:00:00 2001 From: SleepWalker Date: Wed, 9 Aug 2017 21:01:32 +0300 Subject: [PATCH] #349: fix improperly bond action creator (sentry #5527) --- src/pages/profile/ProfilePage.js | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/pages/profile/ProfilePage.js b/src/pages/profile/ProfilePage.js index c187c70..020d647 100644 --- a/src/pages/profile/ProfilePage.js +++ b/src/pages/profile/ProfilePage.js @@ -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 logger from 'services/logger'; - +import { browserHistory } from 'services/history'; import Profile from 'components/profile/Profile'; import ChangePasswordPage from 'pages/profile/ChangePasswordPage'; import ChangeUsernamePage from 'pages/profile/ChangeUsernamePage'; @@ -13,14 +15,12 @@ import { FooterMenu } from 'components/footerMenu'; import styles from './profile.scss'; -class ProfilePage extends Component { - displayName = 'ProfilePage'; +import type { FormModel } from 'components/ui/form'; - static propTypes = { - onSubmit: PropTypes.func.isRequired, - fetchUserData: PropTypes.func.isRequired, - goToProfile: PropTypes.func.isRequired, - children: PropTypes.element +class ProfilePage extends Component { + props: { + onSubmit: ({form: FormModel, sendData: () => Promise<*>}) => void, + fetchUserData: () => Promise<*> }; static childContextTypes = { @@ -31,7 +31,7 @@ class ProfilePage extends Component { getChildContext() { return { 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 { ); } + + goToProfile = () => browserHistory.push('/'); } import { connect } from 'react-redux'; -import { browserHistory } from 'services/history'; import { fetchUserData } from 'components/user/actions'; import { create as createPopup } from 'components/ui/popup/actions'; import PasswordRequestForm from 'components/profile/passwordRequestForm/PasswordRequestForm'; export default connect(null, { - goToProfile() { - return browserHistory.push('/'); - }, fetchUserData, onSubmit: ({form, sendData}) => (dispatch) => { form.beginLoading();