PromucFlow_constructor/app/client/src/actions/actionActions.ts

76 lines
1.5 KiB
TypeScript
Raw Normal View History

2019-10-21 15:12:45 +00:00
import { ReduxActionTypes } from "../constants/ReduxActionConstants";
import { RestAction } from "../api/ActionAPI";
export const createAction = (payload: RestAction) => {
return {
type: ReduxActionTypes.CREATE_ACTION_INIT,
2019-10-21 15:12:45 +00:00
payload,
};
};
export const createActionSuccess = (payload: RestAction) => {
2019-10-21 15:12:45 +00:00
return {
type: ReduxActionTypes.CREATE_ACTION_SUCCESS,
payload,
2019-10-21 15:12:45 +00:00
};
};
export const fetchActions = () => {
2019-10-21 15:12:45 +00:00
return {
type: ReduxActionTypes.FETCH_ACTIONS_INIT,
2019-10-21 15:12:45 +00:00
};
};
export const fetchApiConfig = (payload: { id: string }) => {
return {
type: ReduxActionTypes.FETCH_ACTION,
payload,
};
};
export const runAction = (payload: { id: string }) => {
return {
type: ReduxActionTypes.RUN_ACTION_INIT,
payload,
};
};
export const updateAction = (payload: { data: RestAction }) => {
return {
type: ReduxActionTypes.UPDATE_ACTION_INIT,
payload,
};
};
export const updateActionSuccess = (payload: { data: RestAction }) => {
return {
type: ReduxActionTypes.UPDATE_ACTION_SUCCESS,
2019-10-21 15:12:45 +00:00
payload,
};
};
export const deleteAction = (payload: { id: string }) => {
return {
type: ReduxActionTypes.DELETE_ACTION_INIT,
2019-10-21 15:12:45 +00:00
payload,
};
};
export const deleteActionSuccess = (payload: { id: string }) => {
2019-10-21 15:12:45 +00:00
return {
type: ReduxActionTypes.DELETE_ACTION_SUCCESS,
2019-10-21 15:12:45 +00:00
payload,
};
};
export default {
createAction,
fetchActions,
fetchApiConfig,
runAction,
deleteAction,
deleteActionSuccess,
updateAction,
updateActionSuccess,
2019-10-21 15:12:45 +00:00
};