all files / src/ actions.js

100% Statements 39/39
100% Branches 0/0
100% Functions 16/16
100% Lines 18/18
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53                            13×                                            
import { ADD_ARRAY_VALUE, BLUR, CHANGE, DESTROY, FOCUS, INITIALIZE, REMOVE_ARRAY_VALUE, RESET,
  START_ASYNC_VALIDATION, START_SUBMIT, STOP_ASYNC_VALIDATION, STOP_SUBMIT, SUBMIT_FAILED,
  SWAP_ARRAY_VALUES, TOUCH, UNTOUCH } from './actionTypes'
 
export const addArrayValue = (path, value, index, fields) =>
  ({ type: ADD_ARRAY_VALUE, path, value, index, fields })
 
export const blur = (value) =>
  ({ type: BLUR, value })
 
export const change = (value) =>
  ({ type: CHANGE, value })
 
export const destroy = () =>
  ({ type: DESTROY })
 
export const focus = () =>
  ({ type: FOCUS })
 
export const initialize = (data) => {
  return { type: INITIALIZE, data }
}
 
export const removeArrayValue = (path, index) =>
  ({ type: REMOVE_ARRAY_VALUE, path, index })
 
export const reset = () =>
  ({ type: RESET })
 
export const startAsyncValidation = () =>
  ({ type: START_ASYNC_VALIDATION })
 
export const startSubmit = () =>
  ({ type: START_SUBMIT })
 
export const stopAsyncValidation = errors =>
  ({ type: STOP_ASYNC_VALIDATION, errors })
 
export const stopSubmit = errors =>
  ({ type: STOP_SUBMIT, errors })
 
export const submitFailed = () =>
  ({ type: SUBMIT_FAILED })
 
export const swapArrayValues = (path, indexA, indexB) =>
  ({ type: SWAP_ARRAY_VALUES, path, indexA, indexB })
 
export const touch = (...fields) =>
  ({ type: TOUCH, fields })
 
export const untouch = (...fields) =>
  ({ type: UNTOUCH, fields })