Passed
Pull Request — master (#132)
by Huu-Phat
04:05
created

cms/src/post/containers/Author.js   A

Complexity

Total Complexity 1
Complexity/F 1

Size

Lines of Code 19
Function Count 1

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 13
mnd 0
bc 0
fnc 1
dl 0
loc 19
bpm 0
cpm 1
noi 0
c 0
b 0
f 0
rs 10
1
import { connect } from 'react-redux'
2
import { getPostAuthor, getEditedAuthor } from 'post/state/selectors'
3
import { editPostAuthor } from 'post/state/actions'
4
import Author from 'post/components/Author'
5
6
const mapStateToProps = state => {
7
  const editedAuthor = getEditedAuthor(state)
8
  const author = getPostAuthor(state)
9
  return {
10
    author: editedAuthor || '',
11
    isEdited: editedAuthor !== author
12
  }
13
}
14
15
const mapDispatchToProps = {
16
  editPostAuthor
17
}
18
19
export default connect(mapStateToProps, mapDispatchToProps)(Author)
20