--- a/client/src/components/NoteInput.js Mon Jun 12 18:09:13 2017 +0200
+++ b/client/src/components/NoteInput.js Mon Jun 12 18:12:38 2017 +0200
@@ -1,10 +1,13 @@
-import React, {Component} from 'react';
+import React, { Component } from 'react';
+import { connect } from 'react-redux';
+import { bindActionCreators } from 'redux';
import { Form, FormGroup, Button, Label, Row, Col } from 'react-bootstrap';
import moment from 'moment';
import PropTypes from 'prop-types';
import SlateEditor from './SlateEditor';
import Clock from './Clock'
+import * as notesActions from '../actions/notesActions';
class NoteInput extends Component {
@@ -28,7 +31,7 @@
const html = this.refs.editor.asHtml();
const categories = this.refs.editor.asCategories();
- this.props.addNote(this.props.session, {
+ this.props.notesActions.addNote(this.props.session, {
plain: plain,
raw: raw,
html: html,
@@ -84,8 +87,18 @@
}
}
+function mapStateToProps(state, props) {
+ return {};
+}
+
+function mapDispatchToProps(dispatch) {
+ return {
+ notesActions: bindActionCreators(notesActions, dispatch),
+ }
+}
+
NoteInput.propTypes = {
addNote: PropTypes.func.isRequired
};
-export default NoteInput;
+export default connect(mapStateToProps, mapDispatchToProps)(NoteInput);