woocommerce/plugins/woocommerce-admin/client/marketing/data-multichannel/controls.ts

24 lines
444 B
TypeScript
Raw Normal View History

2023-02-23 18:08:59 +00:00
/**
* External dependencies
*/
import { controls as dataControls } from '@wordpress/data-controls';
import { AnyAction } from 'redux';
2023-02-24 10:32:33 +00:00
export const awaitResponseJson = (
response: Response
): AnyAction & { response: Response } => {
return {
type: 'AWAIT_RESPONSE_JSON',
response,
};
};
2023-02-23 18:08:59 +00:00
const controls = {
...dataControls,
2023-02-24 10:32:33 +00:00
AWAIT_RESPONSE_JSON( action: AnyAction ) {
return action.response.json();
},
2023-02-23 18:08:59 +00:00
};
export default controls;