Server IP : 172.67.158.161 / Your IP : 3.144.29.103 Web Server : LiteSpeed System : Linux business53.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : giankuin ( 1871) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/thread-self/root/home/giankuin/sieuthiweb.com.vn/wp-content/plugins/woocommerce/packages/woocommerce-blocks/assets/js/data/schema/ |
Upload File : |
/** * External dependencies */ import { combineReducers } from '@wordpress/data'; /** * Internal dependencies */ import { ACTION_TYPES as types } from './action-types'; import { extractResourceNameFromRoute, getRouteIds, simplifyRouteWithId, } from './utils'; import { hasInState, updateState } from '../utils'; /** * Reducer for routes * * @param {Object} state The current state. * @param {Object} action The action object for parsing. * * @return {Object} The new (or original) state. */ export const receiveRoutes = ( state = {}, action ) => { const { type, routes, namespace } = action; if ( type === types.RECEIVE_MODEL_ROUTES ) { routes.forEach( ( route ) => { const resourceName = extractResourceNameFromRoute( namespace, route ); if ( resourceName && resourceName !== namespace ) { const routeIdNames = getRouteIds( route ); const savedRoute = simplifyRouteWithId( route, routeIdNames ); if ( ! hasInState( state, [ namespace, resourceName, savedRoute, ] ) ) { state = updateState( state, [ namespace, resourceName, savedRoute ], routeIdNames ); } } } ); } return state; }; export default combineReducers( { routes: receiveRoutes, } );