mirror of
https://github.com/datahub-project/datahub.git
synced 2025-10-28 01:12:41 +00:00
33 lines
1.2 KiB
JavaScript
33 lines
1.2 KiB
JavaScript
|
|
import { createAction } from 'redux-actions';
|
||
|
|
import { createLazyRequest } from 'wherehows-web/actions/entities';
|
||
|
|
import actionSet from 'wherehows-web/actions/action-set';
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Set of actions for Flows
|
||
|
|
* @type {{REQUEST_PAGED_FLOWS: string, SELECT_PAGED_FLOWS: string, RECEIVE_PAGED_FLOWS: string}}
|
||
|
|
*/
|
||
|
|
const ActionTypes = {
|
||
|
|
REQUEST_PAGED_FLOWS: actionSet('REQUEST_PAGED_FLOWS'),
|
||
|
|
SELECT_PAGED_FLOWS: actionSet('SELECT_PAGED_FLOWS'),
|
||
|
|
RECEIVE_PAGED_FLOWS: actionSet('RECEIVE_PAGED_FLOWS')
|
||
|
|
};
|
||
|
|
|
||
|
|
const requestPagedFlows = createAction(ActionTypes.REQUEST_PAGED_FLOWS);
|
||
|
|
|
||
|
|
const selectPagedFlows = createAction(ActionTypes.SELECT_PAGED_FLOWS);
|
||
|
|
|
||
|
|
const receivePagedFlows = createAction(
|
||
|
|
ActionTypes.RECEIVE_PAGED_FLOWS,
|
||
|
|
({ data }) => data,
|
||
|
|
// meta data attached to the ActionTypes.RECEIVE_PAGED_FLOWS action
|
||
|
|
() => ({ receivedAt: Date.now() })
|
||
|
|
);
|
||
|
|
|
||
|
|
// async action/thunk creator for ActionTypes.REQUEST_PAGED_FLOWS
|
||
|
|
const lazyRequestPagedFlows = createLazyRequest('flows', requestPagedFlows, receivePagedFlows);
|
||
|
|
|
||
|
|
// async action/thunk creator for ActionTypes.SELECT_PAGED_FLOWS
|
||
|
|
const lazySelectPagedFlows = createLazyRequest('flows', selectPagedFlows, receivePagedFlows);
|
||
|
|
|
||
|
|
export { ActionTypes, lazyRequestPagedFlows, lazySelectPagedFlows, receivePagedFlows };
|