client/state/posts/actions.js
function requestPosts( siteId, query = {} ) {
	return dispatch => {
		dispatch( {
			type: POSTS_REQUEST,
			siteId,
			query,
		} );

		const source = siteId ? wpcom.site( siteId ) : wpcom.me();

		return source
			.postsList( { ...query } )
			.then( ( { found, posts } ) => {
				dispatch( receivePosts( posts ) );
				dispatch( {
					type: POSTS_REQUEST_SUCCESS,
					siteId,
					query,
					found,
					posts,
				} );
			} )
			.catch( error => {
				dispatch( {
					type: POSTS_REQUEST_FAILURE,
					siteId,
					query,
					error,
				} );
			} );
	};
}
function requestPosts( siteId, query = {} ) {
	return dispatch => {
		dispatch( {
			type: POSTS_REQUEST,
			siteId,
			query,
		} );

		const source = siteId ? wpcom.site( siteId ) : wpcom.me();

		return source
			.postsList( { ...query } )
			.then( ( { found, posts } ) => {
				dispatch( receivePosts( posts ) );
				dispatch( {
					type: POSTS_REQUEST_SUCCESS,
					siteId,
					query,
					found,
					posts,
				} );
			} )
			.catch( error => {
				dispatch( {
					type: POSTS_REQUEST_FAILURE,
					siteId,
					query,
					error,
				} );
			} );
	};
}
function requestPosts ( siteId , query = { } ) { return dispatch => { dispatch ( { type : POSTS_REQUEST , siteId , query , } ) ; const source = siteId ? wpcom . site ( siteId ) : wpcom . me ( ) ; return source . postsList ( { ... query } ) . then ( ( { found , posts } ) => { dispatch ( receivePosts ( posts ) ) ; dispatch ( { type : POSTS_REQUEST_SUCCESS , siteId , query , found , posts , } ) ; } ) . catch ( error => { dispatch ( { type : POSTS_REQUEST_FAILURE , siteId , query , error , } ) ; } ) ; } ; }
Triggers a network request to fetch posts for the specified site and query.

@param  {?Number}  siteId Site ID
@param  {String}   query  Post query
@return {Function}        Action thunk
Triggers a network request to fetch posts for the specified site and query .