'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _immutable = require('immutable');

var _constants = require('../../constants');

exports.default = function () {
  var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : (0, _immutable.Map)({});
  var action = arguments[1];

  switch (action.type) {
    case _constants.CLEAR_ERRORS_SHOWING:
      return (0, _immutable.Map)();
    case _constants.SHOW_ERROR:
      return state.set(action.payload.key, true);
    case _constants.HIDE_ERROR:
      return state.set(action.payload.key, false);
    default:
      return state;
  }
};