Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default (state: LocaleState = initialState, action): LocaleState => {
switch (action.type) {
case ACTION_TYPES.SET_LOCALE:
const currentLocale = action.locale;
if (state.currentLocale !== currentLocale) {
Storage.session.set('locale', currentLocale);
TranslatorContext.setLocale(currentLocale);
}
return {
currentLocale
};
default:
return state;
}
};
export default (state: LocaleState = initialState, action): LocaleState => {
switch (action.type) {
case ACTION_TYPES.SET_LOCALE: {
const currentLocale = action.locale;
if (state.currentLocale !== currentLocale) {
TranslatorContext.setLocale(currentLocale);
}
return {
currentLocale
};
}
default:
return state;
}
};