Download wp-calypso/client/state/data-layer/wpcom/read/organizations/index.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.04 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/state/data-layer/wpcom/read/organizations/index.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/state/data-layer/wpcom/read/organizations/index.js
-
curl -L -o index.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/state/data-layer/wpcom/read/organizations/index.js
1.04 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_ORGANIZATIONS_REQUEST, | |
| READER_ORGANIZATIONS_RECEIVE, | |
| } from 'calypso/state/reader/action-types'; | |
| export const handleOrganizationsRequest = ( action ) => | |
| http( | |
| { | |
| method: 'GET', | |
| path: '/read/organizations', | |
| apiVersion: '1.2', | |
| }, | |
| action | |
| ); | |
| export const organizationRequestReceived = ( action, apiResponse ) => ( { | |
| type: READER_ORGANIZATIONS_RECEIVE, | |
| payload: apiResponse, | |
| } ); | |
| export const organizationRequestFailure = ( error ) => ( { | |
| type: READER_ORGANIZATIONS_RECEIVE, | |
| payload: error, | |
| error: true, | |
| } ); | |
| registerHandlers( 'state/data-layer/wpcom/read/organizations/index.js', { | |
| [ READER_ORGANIZATIONS_REQUEST ]: [ | |
| dispatchRequest( { | |
| fetch: handleOrganizationsRequest, | |
| onSuccess: organizationRequestReceived, | |
| onError: organizationRequestFailure, | |
| } ), | |
| ], | |
| } ); | |