Devendra174's picture
Upload folder using huggingface_hub
1e92f2d verified
import { HOSTING_GEO_AFFINITY_REQUEST, HOSTING_GEO_AFFINITY_SET } from 'calypso/state/action-types';
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';
const getGeoAffinity = ( action ) =>
http(
{
method: 'GET',
path: `/sites/${ action.siteId }/hosting/geo-affinity`,
apiNamespace: 'wpcom/v2',
body: {},
},
action
);
const getGeoAffinitySuccess = ( action, geoAffinity ) => {
return {
type: HOSTING_GEO_AFFINITY_SET,
siteId: action.siteId,
setting: geoAffinity,
};
};
registerHandlers( 'state/data-layer/wpcom/sites/hosting/geo-affinity.js', {
[ HOSTING_GEO_AFFINITY_REQUEST ]: [
dispatchRequest( {
fetch: getGeoAffinity,
onSuccess: getGeoAffinitySuccess,
} ),
],
} );