Minor fixes to stores (https://github.com/woocommerce/woocommerce-admin/pull/868)
* Minor fixes to stores * Fix 'parameters' typo
This commit is contained in:
parent
94200cbbc1
commit
ba7d6ef29f
|
@ -2,15 +2,14 @@
|
|||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
|
||||
import reducer from './reducer';
|
||||
import actions from './actions';
|
||||
import selectors from './selectors';
|
||||
import reducer from './reducer';
|
||||
import resolvers from './resolvers';
|
||||
import selectors from './selectors';
|
||||
|
||||
export default {
|
||||
reducer,
|
||||
actions,
|
||||
selectors,
|
||||
reducer,
|
||||
resolvers,
|
||||
selectors,
|
||||
};
|
||||
|
|
|
@ -16,7 +16,7 @@ import { ERROR } from 'store/constants';
|
|||
* Returns orders for a specific query.
|
||||
*
|
||||
* @param {Object} state Current state
|
||||
* @param {Object} query Report query paremters
|
||||
* @param {Object} query Report query parameters
|
||||
* @return {Array} Report details
|
||||
*/
|
||||
function getOrders( state, query = {} ) {
|
||||
|
@ -27,7 +27,7 @@ export default {
|
|||
getOrders,
|
||||
|
||||
/**
|
||||
* Returns true if a query is pending.
|
||||
* Returns true if a getOrders request is pending.
|
||||
*
|
||||
* @param {Object} state Current state
|
||||
* @return {Boolean} True if the `getOrders` request is pending, false otherwise
|
||||
|
@ -37,7 +37,7 @@ export default {
|
|||
},
|
||||
|
||||
/**
|
||||
* Returns true if a get orders request has returned an error.
|
||||
* Returns true if a getOrders request has returned an error.
|
||||
*
|
||||
* @param {Object} state Current state
|
||||
* @param {Object} query Query parameters
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
* External dependencies
|
||||
*/
|
||||
import deepFreeze from 'deep-freeze';
|
||||
import { select } from '@wordpress/data';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
import { ERROR } from 'store/constants';
|
||||
import selectors from '../selectors';
|
||||
import { select } from '@wordpress/data';
|
||||
import { getJsonString } from 'store/utils';
|
||||
|
||||
const { getOrders, isGetOrdersRequesting, isGetOrdersError } = selectors;
|
||||
|
|
|
@ -6,6 +6,11 @@ import apiFetch from '@wordpress/api-fetch';
|
|||
import { dispatch } from '@wordpress/data';
|
||||
import { stringify } from 'qs';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
import { NAMESPACE } from 'store/constants';
|
||||
|
||||
export default {
|
||||
// TODO: Use controls data plugin or fresh-data instead of async
|
||||
async getProducts( ...args ) {
|
||||
|
@ -15,7 +20,7 @@ export default {
|
|||
|
||||
try {
|
||||
const params = query ? '?' + stringify( query ) : '';
|
||||
const products = await apiFetch( { path: '/wc/v3/reports/products' + params } );
|
||||
const products = await apiFetch( { path: NAMESPACE + 'reports/products' + params } );
|
||||
dispatch( 'wc-admin' ).setProducts( products, query );
|
||||
} catch ( error ) {
|
||||
dispatch( 'wc-admin' ).setProductsError( query );
|
||||
|
|
|
@ -16,7 +16,7 @@ import { getJsonString } from 'store/utils';
|
|||
* Returns products report details for a specific report query.
|
||||
*
|
||||
* @param {Object} state Current state
|
||||
* @param {Object} query Report query paremters
|
||||
* @param {Object} query Report query parameters
|
||||
* @return {Object} Report details
|
||||
*/
|
||||
function getProducts( state, query = {} ) {
|
||||
|
@ -27,7 +27,7 @@ export default {
|
|||
getProducts,
|
||||
|
||||
/**
|
||||
* Returns true if a products request is pending.
|
||||
* Returns true if a getProducts request is pending.
|
||||
*
|
||||
* @param {Object} state Current state
|
||||
* @return {Boolean} True if the `getProducts` request is pending, false otherwise
|
||||
|
@ -37,10 +37,10 @@ export default {
|
|||
},
|
||||
|
||||
/**
|
||||
* Returns true if a products request has returned an error.
|
||||
* Returns true if a getProducts request has returned an error.
|
||||
*
|
||||
* @param {Object} state Current state
|
||||
* @param {Object} query Report query paremters
|
||||
* @param {Object} query Report query parameters
|
||||
* @return {Boolean} True if the `getProducts` request has failed, false otherwise
|
||||
*/
|
||||
isGetProductsError( state, query ) {
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
* External dependencies
|
||||
*/
|
||||
import deepFreeze from 'deep-freeze';
|
||||
import { select } from '@wordpress/data';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
import { ERROR } from 'store/constants';
|
||||
import selectors from '../selectors';
|
||||
import { select } from '@wordpress/data';
|
||||
import { getJsonString } from 'store/utils';
|
||||
|
||||
const { getProducts, isGetProductsRequesting, isGetProductsError } = selectors;
|
||||
|
|
|
@ -4,13 +4,13 @@
|
|||
* Internal dependencies
|
||||
*/
|
||||
import actions from './actions';
|
||||
import selectors from './selectors';
|
||||
import reducer from './reducer';
|
||||
import resolvers from './resolvers';
|
||||
import selectors from './selectors';
|
||||
|
||||
export default {
|
||||
actions,
|
||||
selectors,
|
||||
reducer,
|
||||
resolvers,
|
||||
selectors,
|
||||
};
|
||||
|
|
|
@ -17,7 +17,7 @@ import { getJsonString } from 'store/utils';
|
|||
*
|
||||
* @param {Object} state Current state
|
||||
* @param {String} endpoint Stats endpoint
|
||||
* @param {Object} query Report query paremters
|
||||
* @param {Object} query Report query parameters
|
||||
* @return {Object} Report details
|
||||
*/
|
||||
function getReportStats( state, endpoint, query = {} ) {
|
||||
|
@ -29,7 +29,7 @@ export default {
|
|||
getReportStats,
|
||||
|
||||
/**
|
||||
* Returns true if a stat query is pending.
|
||||
* Returns true if a stats query is pending.
|
||||
*
|
||||
* @param {Object} state Current state
|
||||
* @return {Boolean} True if the `getReportRevenueStats` request is pending, false otherwise
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
* External dependencies
|
||||
*/
|
||||
import deepFreeze from 'deep-freeze';
|
||||
import { select } from '@wordpress/data';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
import { ERROR } from 'store/constants';
|
||||
import selectors from '../selectors';
|
||||
import { select } from '@wordpress/data';
|
||||
|
||||
const { getReportStats, isReportStatsRequesting, isReportStatsError } = selectors;
|
||||
jest.mock( '@wordpress/data', () => ( {
|
||||
|
|
Loading…
Reference in New Issue