mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-10-01 15:57:46 +05:30
parent
c306b07a7a
commit
0a5f2d1e95
@ -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();
|
||||||
|
Loading…
Reference in New Issue
Block a user