No need for bindActionCreators
parent
d855524199
commit
98a1b97574
|
@ -10,7 +10,6 @@ import * as schema from 'src/shared/schemas'
|
|||
import {ADDING, TEMP_ANNOTATION} from 'src/shared/annotations/helpers'
|
||||
|
||||
import {
|
||||
addAnnotation,
|
||||
updateAnnotation,
|
||||
deleteAnnotation,
|
||||
addingAnnotationSuccess,
|
||||
|
@ -34,7 +33,6 @@ class Annotations extends Component {
|
|||
const {
|
||||
mode,
|
||||
isTempHovering,
|
||||
handleAddAnnotation,
|
||||
handleUpdateAnnotation,
|
||||
handleDeleteAnnotation,
|
||||
handleDismissAddingAnnotation,
|
||||
|
@ -59,7 +57,6 @@ class Annotations extends Component {
|
|||
<NewAnnotation
|
||||
dygraph={dygraph}
|
||||
tempAnnotation={tempAnnotation}
|
||||
onAddAnnotation={handleAddAnnotation}
|
||||
onDismissAddingAnnotation={handleDismissAddingAnnotation}
|
||||
onAddingAnnotationSuccess={handleAddingAnnotationSuccess}
|
||||
onUpdateAnnotation={handleUpdateAnnotation}
|
||||
|
@ -97,7 +94,6 @@ Annotations.propTypes = {
|
|||
annotationsRef: func,
|
||||
handleDeleteAnnotation: func.isRequired,
|
||||
handleUpdateAnnotation: func.isRequired,
|
||||
handleAddAnnotation: func.isRequired,
|
||||
handleDismissAddingAnnotation: func.isRequired,
|
||||
handleAddingAnnotationSuccess: func.isRequired,
|
||||
handleMouseEnterTempAnnotation: func.isRequired,
|
||||
|
@ -129,7 +125,6 @@ const mapDispatchToProps = dispatch => ({
|
|||
mouseLeaveTempAnnotation,
|
||||
dispatch
|
||||
),
|
||||
handleAddAnnotation: bindActionCreators(addAnnotation, dispatch),
|
||||
handleUpdateAnnotation: bindActionCreators(updateAnnotation, dispatch),
|
||||
handleDeleteAnnotation: bindActionCreators(deleteAnnotation, dispatch),
|
||||
})
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import React, {Component, PropTypes} from 'react'
|
||||
import classnames from 'classnames'
|
||||
import {connect} from 'react-redux'
|
||||
import {bindActionCreators} from 'redux'
|
||||
import uuid from 'node-uuid'
|
||||
|
||||
import OnClickOutside from 'shared/components/OnClickOutside'
|
||||
|
@ -33,7 +32,7 @@ class NewAnnotation extends Component {
|
|||
|
||||
handleMouseUp = () => {
|
||||
const {
|
||||
addAnnotation,
|
||||
addAnnotationAsync,
|
||||
onAddingAnnotationSuccess,
|
||||
tempAnnotation,
|
||||
onMouseLeaveTempAnnotation,
|
||||
|
@ -48,7 +47,7 @@ class NewAnnotation extends Component {
|
|||
// time on mouse up
|
||||
const endTime = tempAnnotation.startTime
|
||||
|
||||
addAnnotation(createUrl, {
|
||||
addAnnotationAsync(createUrl, {
|
||||
...tempAnnotation,
|
||||
startTime,
|
||||
endTime,
|
||||
|
@ -67,7 +66,7 @@ class NewAnnotation extends Component {
|
|||
onAddingAnnotationSuccess()
|
||||
onMouseLeaveTempAnnotation()
|
||||
|
||||
addAnnotation(createUrl, {
|
||||
addAnnotationAsync(createUrl, {
|
||||
...tempAnnotation,
|
||||
id: uuid.v4(),
|
||||
startTime,
|
||||
|
@ -196,7 +195,7 @@ NewAnnotation.propTypes = {
|
|||
dygraph: shape({}).isRequired,
|
||||
isTempHovering: bool,
|
||||
tempAnnotation: schema.annotation.isRequired,
|
||||
addAnnotation: func.isRequired,
|
||||
addAnnotationAsync: func.isRequired,
|
||||
onDismissAddingAnnotation: func.isRequired,
|
||||
onAddingAnnotationSuccess: func.isRequired,
|
||||
onUpdateAnnotation: func.isRequired,
|
||||
|
@ -204,8 +203,8 @@ NewAnnotation.propTypes = {
|
|||
onMouseLeaveTempAnnotation: func.isRequired,
|
||||
}
|
||||
|
||||
const mdtp = dispatch => ({
|
||||
addAnnotation: bindActionCreators(actions.addAnnotationAsync, dispatch),
|
||||
})
|
||||
const mdtp = {
|
||||
addAnnotationAsync: actions.addAnnotationAsync,
|
||||
}
|
||||
|
||||
export default connect(null, mdtp)(OnClickOutside(NewAnnotation))
|
||||
|
|
Loading…
Reference in New Issue