woocommerce/plugins/woocommerce-admin/client/wc-api/user/selectors.js

25 lines
467 B
JavaScript

/**
* Internal dependencies
*/
import { DEFAULT_REQUIREMENT } from '../constants';
/**
* WooCommerce dependencies
*/
import { getSetting } from '@woocommerce/wc-admin-settings';
const getCurrentUserData = ( getResource, requireResource ) => (
requirement = DEFAULT_REQUIREMENT
) => {
return getSetting(
'currentUserData',
{},
( cud ) =>
requireResource( requirement, 'current-user-data' ).data || cud
);
};
export default {
getCurrentUserData,
};