equal
deleted
inserted
replaced
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 |
55 const currentSession = sessions.find(session => session._id === sessionId); |
58 const currentSession = sessions.find(session => session._id === sessionId); |
|
59 const currentNotes = notes.filter(note => { |
|
60 return note.session === sessionId; |
|
61 }); |
56 |
62 |
57 return { |
63 return { |
58 currentSession, |
64 currentSession, |
59 sessions, |
65 sessions, |
60 notes, |
66 notes: currentNotes, |
61 }; |
67 }; |
62 } |
68 } |
63 |
69 |
64 function mapDispatchToProps(dispatch) { |
70 function mapDispatchToProps(dispatch) { |
65 return { |
71 return { |