23 lines
364 B
TypeScript
Raw Normal View History

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