Download wp-calypso/client/state/admin-menu/reducer.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 958 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/state/admin-menu/reducer.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/state/admin-menu/reducer.js
-
curl -L -o reducer.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/state/admin-menu/reducer.js
958 Bytes
| import { withStorageKey } from '@automattic/state-utils'; | |
| import { ADMIN_MENU_RECEIVE, ADMIN_MENU_REQUEST } from 'calypso/state/action-types'; | |
| import { | |
| keyedReducer, | |
| combineReducers, | |
| withSchemaValidation, | |
| withPersistence, | |
| } from 'calypso/state/utils'; | |
| import 'calypso/state/data-layer/wpcom/sites/admin-menu'; | |
| import { menusSchema } from './schema'; | |
| const menusReducer = ( state = [], action ) => { | |
| switch ( action.type ) { | |
| case ADMIN_MENU_RECEIVE: | |
| return action.menu; | |
| default: | |
| return state; | |
| } | |
| }; | |
| export const menus = withSchemaValidation( | |
| menusSchema, | |
| keyedReducer( 'siteId', withPersistence( menusReducer ) ) | |
| ); | |
| export const requesting = ( state = false, action ) => { | |
| switch ( action.type ) { | |
| case ADMIN_MENU_REQUEST: | |
| case ADMIN_MENU_RECEIVE: | |
| return action.type === ADMIN_MENU_REQUEST; | |
| } | |
| return state; | |
| }; | |
| const reducer = combineReducers( { | |
| menus, | |
| requesting, | |
| } ); | |
| export default withStorageKey( 'adminMenu', reducer ); | |