summaryrefslogtreecommitdiffstats
path: root/front/odiparpack/app/containers/LanguageProvider/reducer.js
blob: 089c426b0150fddda84ec9034a14d8f3979d748d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/*
 *
 * LanguageProvider reducer
 *
 */

import { fromJS } from 'immutable';

import CHANGE_LOCALE from './constants';
import { DEFAULT_LOCALE } from '../../i18n'; // eslint-disable-line

export const initialState = fromJS({
  locale: DEFAULT_LOCALE,
});

function languageProviderReducer(state = initialState, action) {
  switch (action.type) {
    case CHANGE_LOCALE:
      return state.set('locale', action.locale);
    default:
      return state;
  }
}

export default languageProviderReducer;