client/src/components/SessionList.js
changeset 93 469da13402e2
parent 62 b2514a9bcd49
child 95 7bc08467c726
--- a/client/src/components/SessionList.js	Mon Jun 26 16:50:16 2017 +0200
+++ b/client/src/components/SessionList.js	Mon Jun 26 17:40:28 2017 +0200
@@ -16,6 +16,13 @@
     this.props.history.push('/sessions/' + sessionId);
   }
 
+  onClickDelete(session, e) {
+    e.preventDefault();
+    e.stopPropagation();
+
+    this.props.sessionsActions.deleteSession(session);
+  }
+
   render() {
     return (
       <div>
@@ -29,6 +36,9 @@
                     key={session.get('_id')}
                     onClick={() => this.props.history.push('/sessions/' + session.get('_id'))}>
                     {session.title || 'No title'} {session.get('_id')} {moment(session.get('date')).format('DD/MM/YYYY')}
+                    <a className="pull-right" onClick={ this.onClickDelete.bind(this, session) }>
+                      <span className="material-icons">delete</span>
+                    </a>
                   </ListGroupItem>
                 )}
               </ListGroup>
@@ -43,8 +53,6 @@
 
 function mapStateToProps(state, props) {
   return {
-    // currentSession: state.get('currentSession'),
-    // sessions: state.get('sessions')
     sessions: state['sessions']
   };
 }