Skip to content
This repository has been archived by the owner on Jan 1, 2024. It is now read-only.

Commit

Permalink
feat(containers): add data fetching in Links
Browse files Browse the repository at this point in the history
feat(containers): add data fetching in Links
  • Loading branch information
Metnew committed Dec 3, 2017
1 parent 7344e04 commit 2e653e9
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/common/containers/Links/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,19 @@ type Props = {
class Links extends Component {
props: Props

componentDidMount () {
const {isLinksLoaded} = this.props
async asyncBootstrap () {
const {isLinksLoaded, getLinks} = this.props
if (!isLinksLoaded) {
this.getLinks()
await getLinks()
}
return true
}

getLinks () {
this.props.getLinks()
componentDidMount () {
const {isLinksLoaded, getLinks} = this.props
if (!isLinksLoaded) {
getLinks()
}
}

render () {
Expand Down Expand Up @@ -57,8 +61,8 @@ function mapStateToProps (state: GlobalState) {
}

const mapDispatchToProps = dispatch => ({
getLinks () {
dispatch(GET_LINKS())
async getLinks () {
return dispatch(GET_LINKS())
}
})

Expand Down

0 comments on commit 2e653e9

Please sign in to comment.