%PDF- %PDF-
Direktori : /home/emergentqj/actioncivile/pre-auth/.8352c036a19b0051d0217d27d25e3f4a/static/js/reducers/ |
Current File : /home/emergentqj/actioncivile/pre-auth/.8352c036a19b0051d0217d27d25e3f4a/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;