accounts-frontend/packages/app/components/i18n/reducer.ts
2020-05-24 02:08:24 +03:00

20 lines
371 B
TypeScript

import i18n from 'app/services/i18n';
import { Action } from './actions';
export interface State {
locale: string;
}
const defaultState: State = {
locale: i18n.detectLanguage(),
};
export default function (state: State = defaultState, { type, payload }: Action): State {
if (type === 'i18n:setLocale') {
return payload;
}
return state;
}