mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-12-02 19:50:44 +05:30
21 lines
375 B
TypeScript
21 lines
375 B
TypeScript
import i18n from 'app/services/i18n';
|
|
|
|
import { SET_LOCALE } from './actions';
|
|
|
|
export type State = { locale: string };
|
|
|
|
const defaultState = {
|
|
locale: i18n.detectLanguage(),
|
|
};
|
|
|
|
export default function(
|
|
state: State = defaultState,
|
|
{ type, payload }: { type: string; payload: State },
|
|
): State {
|
|
if (type === SET_LOCALE) {
|
|
return payload;
|
|
}
|
|
|
|
return state;
|
|
}
|