quickbuild
Version:
A mature, feature-complete application generator with an emphasis on speed
27 lines (21 loc) • 529 B
JavaScript
/*
*
* LanguageProvider reducer
*
*/
import produce from 'immer';
import { CHANGE_LOCALE } from './constants';
import { DEFAULT_LOCALE } from '../../i18n';
export const initialState = {
locale: DEFAULT_LOCALE,
};
/* eslint-disable default-case, no-param-reassign */
const languageProviderReducer = (state = initialState, action) =>
produce(state, draft => {
switch (action.type) {
case CHANGE_LOCALE:
draft.locale = action.locale;
break;
}
});
export default languageProviderReducer;