%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/emergentqj/actioncivile/pre-auth/.f81b4c9eb38fd76cdf20462cf2027aa3/static/js/reducers/
Upload File :
Create Path :
Current File : /home/emergentqj/actioncivile/pre-auth/.f81b4c9eb38fd76cdf20462cf2027aa3/static/js/reducers/config.js

import { fromJS } from "immutable";
import appConfig from "config/countryData";
import LIST_ACTIONS from "constants/action_types";

const initialState = fromJS({
  config: {},
  languageManuallySet: false,
});

const config = (state = initialState, action = {}) => {
  switch (action.type) {
    case LIST_ACTIONS.SET_ENV_CONSTANTS:
      return state.set("config", action.model);
    case LIST_ACTIONS.SET_COUNTRY: {
      if (!appConfig.countryData[action.payload]) {
        return state;
      }

      const nextState = {
        ...state.toJS(),
        config: {
          ...state.toJS().config,
          countryConstant: action.payload,
          appConfig: appConfig.countryData[action.payload],
        },
      };
      return fromJS(nextState);
    }
    case LIST_ACTIONS.SET_LANGUAGE_MANUALLY_SET:
      return state.set("languageManuallySet", action.payload);
    default:
      return state;
  }
};

export default config;

Zerion Mini Shell 1.0