Download wp-calypso/client/state/data-layer/wpcom/me/blocks/sites/index.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.15 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/state/data-layer/wpcom/me/blocks/sites/index.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/state/data-layer/wpcom/me/blocks/sites/index.js
-
curl -L -o index.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/state/data-layer/wpcom/me/blocks/sites/index.js
1.15 kB
| import { registerHandlers } from 'calypso/state/data-layer/handler-registry'; | |
| import { http } from 'calypso/state/data-layer/wpcom-http/actions'; | |
| import { dispatchRequest } from 'calypso/state/data-layer/wpcom-http/utils'; | |
| import { | |
| READER_SITE_BLOCKS_RECEIVE, | |
| READER_SITE_BLOCKS_REQUEST, | |
| } from 'calypso/state/reader/action-types'; | |
| export const handleSiteBlocksRequest = ( action ) => | |
| http( | |
| { | |
| apiNamespace: 'wpcom/v2', | |
| method: 'GET', | |
| path: '/me/blocks/sites', | |
| query: { | |
| page: ( action.payload && action.payload.page ) || 1, | |
| per_page: ( action.payload && action.perPage ) || 20, | |
| }, | |
| }, | |
| action | |
| ); | |
| export const siteBlocksRequestReceived = ( action, payload ) => ( { | |
| type: READER_SITE_BLOCKS_RECEIVE, | |
| payload, | |
| } ); | |
| export const siteBlocksRequestFailure = ( error ) => ( { | |
| type: READER_SITE_BLOCKS_RECEIVE, | |
| payload: error, | |
| error: true, | |
| } ); | |
| registerHandlers( 'state/data-layer/wpcom/me/blocks/sites/index.js', { | |
| [ READER_SITE_BLOCKS_REQUEST ]: [ | |
| dispatchRequest( { | |
| fetch: handleSiteBlocksRequest, | |
| onSuccess: siteBlocksRequestReceived, | |
| onError: siteBlocksRequestFailure, | |
| } ), | |
| ], | |
| } ); | |
| export default {}; | |