21 lines
375 B
TypeScript
Raw Normal View History

import i18n from 'app/services/i18n';
2019-11-11 10:40:05 +02:00
2016-05-19 22:41:43 +03:00
import { SET_LOCALE } from './actions';
2019-12-07 13:28:52 +02:00
export type State = { locale: string };
2019-11-11 10:40:05 +02:00
const defaultState = {
locale: i18n.detectLanguage(),
2019-11-11 10:40:05 +02:00
};
export default function(
state: State = defaultState,
2019-12-07 13:28:52 +02:00
{ type, payload }: { type: string; payload: State },
2019-11-11 10:40:05 +02:00
): State {
if (type === SET_LOCALE) {
return payload;
}
2016-05-19 22:41:43 +03:00
return state;
2016-05-19 22:41:43 +03:00
}