Skip to content

Commit

Permalink
Replace flowRight with compose in author block.
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgefilipecosta committed Dec 15, 2017
1 parent ec7be13 commit cd9423a
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions blocks/library/author/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
* External Dependencies
*/
import { connect } from 'react-redux';
import { flowRight } from 'lodash';

/**
* WordPress depensdencies
*/
import { Component } from '@wordpress/element';
import { Component, compose } from '@wordpress/element';
import { __ } from '@wordpress/i18n';
import { PanelBody, withAPIData, Placeholder, Spinner } from '@wordpress/components';

Expand Down Expand Up @@ -97,17 +96,13 @@ class AuthorBlock extends Component {
}
}

const applyWithAPIData = withAPIData( ( props ) => ( {
author: `/wp/v2/users/${ props.postAuthorId }`,
} ) );

const applyConnect = connect(
( state ) => ( {
postAuthorId: getCurrentPostAuthor( state ),
} )
);

export default flowRight( [
applyConnect,
applyWithAPIData,
] )( AuthorBlock );
export default compose(
connect(
( state ) => ( {
postAuthorId: getCurrentPostAuthor( state ),
} )
),
withAPIData( ( props ) => ( {
author: `/wp/v2/users/${ props.postAuthorId }`,
} ) )
)( AuthorBlock );

0 comments on commit cd9423a

Please sign in to comment.