client/src/components/Session.js
changeset 59 1eb52770eefa
parent 58 f16a080e0bc4
child 62 b2514a9bcd49
equal deleted inserted replaced
58:f16a080e0bc4 59:1eb52770eefa
    11 import * as notesActions from '../actions/notesActions';
    11 import * as notesActions from '../actions/notesActions';
    12 
    12 
    13 class Session extends Component {
    13 class Session extends Component {
    14 
    14 
    15   componentDidMount = () => {
    15   componentDidMount = () => {
    16     //this.props.notesActions.loadNotesBySession({ _id: this.props.match.params.id });
    16     this.props.notesActions.loadNotesBySession({ _id: this.props.match.params.id });
    17   }
    17   }
    18 
    18 
    19   render() {
    19   render() {
    20     return (
    20     return (
    21       <div>
    21       <div>
    48 
    48 
    49 function mapStateToProps(state, props) {
    49 function mapStateToProps(state, props) {
    50 
    50 
    51   const sessionId = props.match.params.id;
    51   const sessionId = props.match.params.id;
    52 
    52 
    53 //   const sessions = state.get('sessions');
    53   const sessions = state.get('sessions');
    54 //   const notes = state.get('notes');
    54   const notes = state.get('notes');
    55   const sessions = state['sessions'];
       
    56   const notes = state['notes'];
       
    57 
       
    58   const currentSession = sessions.find(session => session._id === sessionId);
    55   const currentSession = sessions.find(session => session._id === sessionId);
    59   const currentNotes = notes.filter(note => {
       
    60         return note.session === sessionId;
       
    61     });
       
    62 
    56 
    63   return {
    57   return {
    64     currentSession,
    58     currentSession,
    65     sessions,
    59     sessions,
    66     notes: currentNotes,
    60     notes,
    67   };
    61   };
    68 }
    62 }
    69 
    63 
    70 function mapDispatchToProps(dispatch) {
    64 function mapDispatchToProps(dispatch) {
    71   return {
    65   return {