diff --git a/js/components/ascribe_settings/account_settings.js b/js/components/ascribe_settings/account_settings.js index b4d46b2d..0591b350 100644 --- a/js/components/ascribe_settings/account_settings.js +++ b/js/components/ascribe_settings/account_settings.js @@ -2,9 +2,6 @@ import React from 'react'; -import UserStore from '../../stores/user_store'; -import UserActions from '../../actions/user_actions'; - import GlobalNotificationModel from '../../models/global_notification_model'; import GlobalNotificationActions from '../../actions/global_notification_actions'; @@ -19,38 +16,26 @@ import AppConstants from '../../constants/application_constants'; import { getLangText } from '../../utils/lang_utils'; let AccountSettings = React.createClass({ - getInitialState() { - return UserStore.getState(); - }, - - componentDidMount() { - UserStore.listen(this.onChange); - UserActions.fetchCurrentUser(); - }, - - componentWillUnmount() { - UserStore.unlisten(this.onChange); - }, - - onChange(state) { - this.setState(state); + propTypes: { + currentUser: React.PropTypes.object.required, + loadUser: React.PropTypes.func.required }, handleSuccess(){ - UserActions.fetchCurrentUser(); + this.props.loadUser(); let notification = new GlobalNotificationModel(getLangText('Settings succesfully updated'), 'success', 5000); GlobalNotificationActions.appendGlobalNotification(notification); }, getFormDataProfile(){ - return {'email': this.state.currentUser.email}; + return {'email': this.props.currentUser.email}; }, render() { let content = ; let profile = null; - if (this.state.currentUser.username) { + if (this.props.currentUser.username) { content = (