text: import lensPath from 'ramda/src/lensPath';
  import set from 'ramda/src/set';
  import * as AT from './actionTypes';
  import { newObj } from '../lib';
  
  
  
  const INITIAL_STATE = {
    masks: [],
    loading: false,
  };
  
  
  function masksReducer(state = INITIAL_STATE, action = {},) {
    const { type, payload } = action;
  
    switch (type) {
      case AT.CLEAR: {
        return newObj(INITIAL_STATE);
      }
  
      case AT.SET_MASKS: {
        state.masks = payload;
        return newObj(state);
      }
  
      case AT.MASKS_LOADING: {
        state.loading = true;
        return newObj(state);
      }
  
      case AT.MASKS_LOADING_SUCCESSFUL: {
        state.loading = false;
        return newObj(state);
      }
  
      case AT.MASKS_LOADING_FAILURE: {
        state.loading = false;
        return newObj(state);
      }
  
      default:
        return state;
    }
  }
  
  export default masksReducer;
  