client/src/components/Settings.js
changeset 168 ea92f4fe783d
parent 151 57d63a248f0d
child 170 7da1d5137b0b
equal deleted inserted replaced
167:1f340f3597a8 168:ea92f4fe783d
     3 import { bindActionCreators } from 'redux';
     3 import { bindActionCreators } from 'redux';
     4 import '../App.css';
     4 import '../App.css';
     5 import Navbar from './Navbar';
     5 import Navbar from './Navbar';
     6 import * as userActions from '../actions/userActions';
     6 import * as userActions from '../actions/userActions';
     7 import './Settings.css';
     7 import './Settings.css';
       
     8 import { getCurrentUser } from '../selectors/authSelectors';
     8 
     9 
     9 class Settings extends Component {
    10 class Settings extends Component {
    10 
    11 
    11   updateSettings = () => {
    12   updateSettings = (e) => {
       
    13     e.preventDefault();
    12     const username = this.props.currentUser.username;
    14     const username = this.props.currentUser.username;
    13     const firstname = this.firstname.value;
    15     const firstname = this.firstname.value;
    14     const lastname = this.lastname.value;
    16     const lastname = this.lastname.value;
    15 
    17 
    16     this.props.userActions.updateSettings(username, firstname, lastname);
    18     this.props.userActions.updateSettings(username, firstname, lastname);
    56   }
    58   }
    57 }
    59 }
    58 
    60 
    59 function mapStateToProps(state, props) {
    61 function mapStateToProps(state, props) {
    60   return {
    62   return {
    61     currentUser: state.getIn(['authStatus', 'currentUser']),
    63     currentUser: getCurrentUser(state),
    62   };
    64   };
    63 }
    65 }
    64 
    66 
    65 function mapDispatchToProps(dispatch) {
    67 function mapDispatchToProps(dispatch) {
    66   return {
    68   return {