"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = exports.initialState = void 0;

var _immutable = require("immutable");

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

var initialState = (0, _immutable.fromJS)({
  globalConfig: {},
  globalConfigError: ""
});
/* eslint-disable default-case, no-param-reassign */

exports.initialState = initialState;

var appReducer = function appReducer() {
  var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
  var action = arguments.length > 1 ? arguments[1] : undefined;

  switch (action.type) {
    case _constants.GET_CONFIG:
      window.__INITIAL_STATE__ = action.data;
      window.globalConfig = require('kit_global_config')["default"];
      createStoreage.set("globalConfig", window.globalConfig);
      return state.merge({
        globalConfig: createStoreage.get("globalConfig")
      });

    case _constants.GET_ERROR_CONFIG:
      return state.merge({
        globalConfigError: action.data
      });

    default:
      return state;
  }
};

var _default = appReducer;
exports["default"] = _default;