Download wp-calypso/client/state/connected-applications/reducer.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 707 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/state/connected-applications/reducer.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/state/connected-applications/reducer.js
-
curl -L -o reducer.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/state/connected-applications/reducer.js
707 Bytes
| import { withStorageKey } from '@automattic/state-utils'; | |
| import { reject } from 'lodash'; | |
| import { | |
| CONNECTED_APPLICATION_DELETE_SUCCESS, | |
| CONNECTED_APPLICATIONS_RECEIVE, | |
| } from 'calypso/state/action-types'; | |
| import { withSchemaValidation } from 'calypso/state/utils'; | |
| import schema from './schema'; | |
| const reducer = ( state = null, action ) => { | |
| switch ( action.type ) { | |
| case CONNECTED_APPLICATION_DELETE_SUCCESS: | |
| return reject( state, { ID: action.appId } ); | |
| case CONNECTED_APPLICATIONS_RECEIVE: | |
| return action.apps; | |
| default: | |
| return state; | |
| } | |
| }; | |
| const validatedReducer = withSchemaValidation( schema, reducer ); | |
| export default withStorageKey( 'connectedApplications', validatedReducer ); | |